From 69454b030ee9500d65fcb258adf28948deb7f7d7 Mon Sep 17 00:00:00 2001 From: wwqgtxx Date: Tue, 5 Nov 2024 09:15:30 +0800 Subject: [PATCH] chore: allow disabled overrideAndroidVPN by environment variable `DISABLE_OVERRIDE_ANDROID_VPN` --- listener/sing_tun/server.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/listener/sing_tun/server.go b/listener/sing_tun/server.go index ad3d113e4..ba337b01a 100644 --- a/listener/sing_tun/server.go +++ b/listener/sing_tun/server.go @@ -279,7 +279,11 @@ func New(options LC.Tun, tunnel C.Tunnel, additions ...inbound.Addition) (l *Lis return } - defaultInterfaceMonitor, err = tun.NewDefaultInterfaceMonitor(networkUpdateMonitor, log.SingLogger, tun.DefaultInterfaceMonitorOptions{InterfaceFinder: interfaceFinder, OverrideAndroidVPN: true}) + overrideAndroidVPN := true + if disable, _ := strconv.ParseBool(os.Getenv("DISABLE_OVERRIDE_ANDROID_VPN")); disable { + overrideAndroidVPN = false + } + defaultInterfaceMonitor, err = tun.NewDefaultInterfaceMonitor(networkUpdateMonitor, log.SingLogger, tun.DefaultInterfaceMonitorOptions{InterfaceFinder: interfaceFinder, OverrideAndroidVPN: overrideAndroidVPN}) if err != nil { err = E.Cause(err, "create DefaultInterfaceMonitor") return