From fe69ec7d6c7f0738585ec7dad4d64ac3d2a2e792 Mon Sep 17 00:00:00 2001 From: yaling888 <73897884+yaling888@users.noreply.github.com> Date: Sat, 7 May 2022 04:14:09 +0800 Subject: [PATCH] Fix: patch tun configs --- listener/listener.go | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/listener/listener.go b/listener/listener.go index 67424cc7..e2a182ba 100644 --- a/listener/listener.go +++ b/listener/listener.go @@ -71,7 +71,10 @@ type Ports struct { func GetTunConf() config.Tun { if lastTunConf == nil { return config.Tun{ - Enable: false, + Enable: false, + Stack: C.TunGvisor, + DNSHijack: []netip.AddrPort{netip.MustParseAddrPort("0.0.0.0:53")}, + AutoRoute: true, } } return *lastTunConf @@ -354,10 +357,11 @@ func ReCreateTun(tunConf *config.Tun, tunAddressPrefix *netip.Prefix, tcpIn chan _ = tunStackListener.Close() tunStackListener = nil - lastTunConf = nil - lastTunAddressPrefix = nil } + lastTunConf = tunConf + lastTunAddressPrefix = tunAddressPrefix + if !tunConf.Enable { return } @@ -366,9 +370,6 @@ func ReCreateTun(tunConf *config.Tun, tunAddressPrefix *netip.Prefix, tcpIn chan if err != nil { return } - - lastTunConf = tunConf - lastTunAddressPrefix = tunAddressPrefix } func ReCreateMitm(port int, tcpIn chan<- C.ConnContext) {