Fix: patch tun configs

This commit is contained in:
yaling888 2022-05-07 04:14:09 +08:00
parent 045b67524c
commit fe69ec7d6c

View File

@ -72,6 +72,9 @@ func GetTunConf() config.Tun {
if lastTunConf == nil {
return config.Tun{
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) {