mirror of
https://github.com/2dust/v2rayNG.git
synced 2026-10-29 06:31:54 +00:00
fix(deps): update hev-socks5-tunnel to 2.19.3 (#6357)
* chore(deps): update hev-socks5-tunnel to 2.19.2 * fix(root): disable jumbo for LAN forwarding * fix(root): guard IPv6 LAN TSO fallback * chore(deps): update hev-socks5-tunnel to 2.19.3
This commit is contained in:
1 parent
1b78a510f2
commit
0f961c54c8
3 files changed
+51
-4
No files matched your search
@@ -126,7 +126,7 @@ object RootProxyManager {
|
|||||||
val lanShare = forceLanShare || MmkvManager.decodeSettingsBool(AppConfig.PREF_ROOT_LAN_SHARING)
|
val lanShare = forceLanShare || MmkvManager.decodeSettingsBool(AppConfig.PREF_ROOT_LAN_SHARING)
|
||||||
val corePid = Process.myPid()
|
val corePid = Process.myPid()
|
||||||
|
|
||||||
val config = buildHevConfig(socksUsername, socksPassword, port, ipv6)
|
val config = buildHevConfig(socksUsername, socksPassword, port, ipv6, SettingsManager.getVpnMtu(), lanShare)
|
||||||
if (!writeHevConfig(cfgFile, config)) {
|
if (!writeHevConfig(cfgFile, config)) {
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
@@ -209,14 +209,28 @@ object RootProxyManager {
|
|||||||
* tun address when IPv6 is enabled; whether v6 actually flows in is decided separately by
|
* tun address when IPv6 is enabled; whether v6 actually flows in is decided separately by
|
||||||
* the v6 route into [TABLE].
|
* the v6 route into [TABLE].
|
||||||
*/
|
*/
|
||||||
private fun buildHevConfig(socksUsername: String?, socksPassword: String?, socksPort: Int, ipv6: Boolean): String {
|
internal fun buildHevConfig(
|
||||||
|
socksUsername: String?,
|
||||||
|
socksPassword: String?,
|
||||||
|
socksPort: Int,
|
||||||
|
ipv6: Boolean,
|
||||||
|
mtu: Int,
|
||||||
|
lanSharing: Boolean,
|
||||||
|
): String {
|
||||||
val v4 = AppConfig.ROOT_TUN_ADDR_V4.substringBefore("/")
|
val v4 = AppConfig.ROOT_TUN_ADDR_V4.substringBefore("/")
|
||||||
val v6 = AppConfig.ROOT_TUN_ADDR_V6.substringBefore("/")
|
val v6 = AppConfig.ROOT_TUN_ADDR_V6.substringBefore("/")
|
||||||
return buildString {
|
return buildString {
|
||||||
appendLine("tunnel:")
|
appendLine("tunnel:")
|
||||||
appendLine(" name: '$TUN'")
|
appendLine(" name: '$TUN'")
|
||||||
appendLine(" mtu: ${SettingsManager.getVpnMtu()}")
|
appendLine(" mtu: $mtu")
|
||||||
appendLine(" multi-queue: true")
|
appendLine(" multi-queue: true")
|
||||||
|
if (lanSharing) {
|
||||||
|
// VNET setup or TCP-GSO EINVAL on Android can leave IPv6 packets above the LAN MTU.
|
||||||
|
// Remove when both fallback forwarding tests pass with jumbo and TSO enabled.
|
||||||
|
appendLine(" offload:")
|
||||||
|
appendLine(" jumbo: false")
|
||||||
|
if (ipv6) appendLine(" tso: false")
|
||||||
|
}
|
||||||
appendLine(" ipv4: '$v4'")
|
appendLine(" ipv4: '$v4'")
|
||||||
if (ipv6) appendLine(" ipv6: '$v6'")
|
if (ipv6) appendLine(" ipv6: '$v6'")
|
||||||
appendLine("socks5:")
|
appendLine("socks5:")
|
||||||
|
|||||||
@@ -1,10 +1,43 @@
|
|||||||
package com.v2ray.ang.root
|
package com.v2ray.ang.root
|
||||||
|
|
||||||
import org.junit.jupiter.api.Assertions.assertEquals
|
import org.junit.jupiter.api.Assertions.assertEquals
|
||||||
|
import org.junit.jupiter.api.Assertions.assertFalse
|
||||||
|
import org.junit.jupiter.api.Assertions.assertTrue
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
|
|
||||||
class RootProxyManagerTest {
|
class RootProxyManagerTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun `IPv6 LAN forwarding disables jumbo and TSO`() {
|
||||||
|
val config = RootProxyManager.buildHevConfig(null, null, 10808, true, 1500, true)
|
||||||
|
|
||||||
|
assertTrue(config.contains(" offload:\n jumbo: false\n"))
|
||||||
|
assertTrue(config.contains(" multi-queue: true\n"))
|
||||||
|
assertTrue(config.contains(" tso: false\n"))
|
||||||
|
assertFalse(config.contains("uso:"))
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun `local root keeps default offloads and configured MTU`() {
|
||||||
|
val config = RootProxyManager.buildHevConfig(null, null, 10808, true, 8500, false)
|
||||||
|
|
||||||
|
assertFalse(config.contains("offload:"))
|
||||||
|
assertTrue(config.contains(" mtu: 8500\n"))
|
||||||
|
assertTrue(config.contains(" ipv6:"))
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun `LAN offload guard preserves IPv4 only and quoted authentication`() {
|
||||||
|
val config = RootProxyManager.buildHevConfig("user'name", "pa'ss", 10809, false, 1500, true)
|
||||||
|
|
||||||
|
assertTrue(config.contains(" offload:\n jumbo: false\n"))
|
||||||
|
assertFalse(config.contains("tso:"))
|
||||||
|
assertFalse(config.contains(" ipv6:"))
|
||||||
|
assertTrue(config.contains(" port: 10809\n"))
|
||||||
|
assertTrue(config.contains(" username: 'user''name'\n"))
|
||||||
|
assertTrue(config.contains(" password: 'pa''ss'\n"))
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `single quotes are escaped in YAML scalars`() {
|
fun `single quotes are escaped in YAML scalars`() {
|
||||||
assertEquals("'user''name'", "user'name".toSingleQuotedYamlScalar())
|
assertEquals("'user''name'", "user'name".toSingleQuotedYamlScalar())
|
||||||
|
|||||||
+1
-1
Submodule hev-socks5-tunnel updated: d9dca26c7a...c5584feca8.
Reference in new issue
Block a user