Improve: use lwip stack instead of kernel

This commit is contained in:
Kr328
2021-05-21 21:02:22 +08:00
parent eff310ac40
commit 7381b787f3
15 changed files with 198 additions and 155 deletions

View File

@@ -217,8 +217,6 @@ class TunService : VpnService(), CoroutineScope by CoroutineScope(Dispatchers.De
fd = establish()?.detachFd()
?: throw NullPointerException("Establish VPN rejected by system"),
mtu = TUN_MTU,
gateway = TUN_GATEWAY,
mirror = TUN_MIRROR,
dns = if (store.dnsHijacking) NET_ANY else TUN_DNS,
)
}
@@ -230,7 +228,6 @@ class TunService : VpnService(), CoroutineScope by CoroutineScope(Dispatchers.De
private const val TUN_MTU = 9000
private const val TUN_SUBNET_PREFIX = 30
private const val TUN_GATEWAY = "172.31.255.253"
private const val TUN_MIRROR = "172.31.255.254"
private const val TUN_DNS = "198.18.0.1"
private const val NET_ANY = "0.0.0.0"
}

View File

@@ -16,8 +16,6 @@ class TunModule(private val vpn: VpnService) : Module<Unit>(vpn) {
data class TunDevice(
val fd: Int,
val mtu: Int,
val gateway: String,
val mirror: String,
val dns: String
)
@@ -58,8 +56,6 @@ class TunModule(private val vpn: VpnService) : Module<Unit>(vpn) {
Clash.startTun(
fd = device.fd,
mtu = device.mtu,
gateway = device.gateway,
mirror = device.mirror,
dns = device.dns,
markSocket = vpn::protect,
querySocketUid = this::queryUid