fix dns hijack not working
This commit is contained in:
2 files changed
+7
-2
No files matched your search
@@ -11,6 +11,7 @@ import com.github.kr328.clash.core.model.Traffic
|
||||
import com.github.kr328.clash.core.transact.DoneCallbackImpl
|
||||
import com.github.kr328.clash.core.transact.ProxyCollectionImpl
|
||||
import com.github.kr328.clash.core.transact.ProxyGroupCollectionImpl
|
||||
import com.github.kr328.clash.core.utils.Log
|
||||
import kotlinx.coroutines.CompletableDeferred
|
||||
import java.io.File
|
||||
import java.io.InputStream
|
||||
@@ -50,6 +51,8 @@ object Clash {
|
||||
onNewSocket: (Int) -> Boolean,
|
||||
onTunStop: () -> Unit
|
||||
) {
|
||||
Log.d("$gateway $mirror $dns")
|
||||
|
||||
Bridge.startTunDevice(fd.toLong(), mtu.toLong(), gateway, mirror, dns, object: TunCallback {
|
||||
override fun onCreateSocket(fd: Long) {
|
||||
onNewSocket(fd.toInt())
|
||||
|
||||
@@ -84,7 +84,7 @@ class TunModule(private val service: VpnService) : Module() {
|
||||
c.mtu,
|
||||
c.gateway4,
|
||||
c.mirror4,
|
||||
"0.0.0.0:53",
|
||||
IPV4_ANY,
|
||||
service::protect,
|
||||
service::stopSelf
|
||||
)
|
||||
@@ -94,7 +94,7 @@ class TunModule(private val service: VpnService) : Module() {
|
||||
c.mtu,
|
||||
c.gateway4,
|
||||
c.mirror4,
|
||||
"${c.dnsAddress}:53",
|
||||
c.dnsAddress,
|
||||
service::protect,
|
||||
service::stopSelf
|
||||
)
|
||||
@@ -107,6 +107,8 @@ class TunModule(private val service: VpnService) : Module() {
|
||||
}
|
||||
|
||||
companion object {
|
||||
private const val IPV4_ANY = "0.0.0.0"
|
||||
|
||||
fun requestStop() {
|
||||
Clash.stopTunDevice()
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user