Fix: patch tun configs
This commit is contained in:
parent
045b67524c
commit
fe69ec7d6c
@ -71,7 +71,10 @@ type Ports struct {
|
|||||||
func GetTunConf() config.Tun {
|
func GetTunConf() config.Tun {
|
||||||
if lastTunConf == nil {
|
if lastTunConf == nil {
|
||||||
return config.Tun{
|
return config.Tun{
|
||||||
Enable: false,
|
Enable: false,
|
||||||
|
Stack: C.TunGvisor,
|
||||||
|
DNSHijack: []netip.AddrPort{netip.MustParseAddrPort("0.0.0.0:53")},
|
||||||
|
AutoRoute: true,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return *lastTunConf
|
return *lastTunConf
|
||||||
@ -354,10 +357,11 @@ func ReCreateTun(tunConf *config.Tun, tunAddressPrefix *netip.Prefix, tcpIn chan
|
|||||||
|
|
||||||
_ = tunStackListener.Close()
|
_ = tunStackListener.Close()
|
||||||
tunStackListener = nil
|
tunStackListener = nil
|
||||||
lastTunConf = nil
|
|
||||||
lastTunAddressPrefix = nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
lastTunConf = tunConf
|
||||||
|
lastTunAddressPrefix = tunAddressPrefix
|
||||||
|
|
||||||
if !tunConf.Enable {
|
if !tunConf.Enable {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -366,9 +370,6 @@ func ReCreateTun(tunConf *config.Tun, tunAddressPrefix *netip.Prefix, tcpIn chan
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
lastTunConf = tunConf
|
|
||||||
lastTunAddressPrefix = tunAddressPrefix
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func ReCreateMitm(port int, tcpIn chan<- C.ConnContext) {
|
func ReCreateMitm(port int, tcpIn chan<- C.ConnContext) {
|
||||||
|
Reference in New Issue
Block a user