mirror of
https://github.com/SagerNet/sing-tun.git
synced 2025-04-04 20:37:43 +03:00
Fix macos monitor
This commit is contained in:
parent
6999634511
commit
91df97aee2
2 changed files with 10 additions and 4 deletions
|
@ -39,5 +39,6 @@ type DefaultInterfaceMonitor interface {
|
||||||
}
|
}
|
||||||
|
|
||||||
type DefaultInterfaceMonitorOptions struct {
|
type DefaultInterfaceMonitorOptions struct {
|
||||||
OverrideAndroidVPN bool
|
OverrideAndroidVPN bool
|
||||||
|
UnderNetworkExtension bool
|
||||||
}
|
}
|
||||||
|
|
|
@ -122,11 +122,16 @@ func (m *defaultInterfaceMonitor) checkUpdate() error {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
if defaultInterface == nil {
|
if defaultInterface == nil {
|
||||||
defaultInterface, err = getDefaultInterfaceBySocket()
|
if m.options.UnderNetworkExtension {
|
||||||
if err != nil {
|
defaultInterface, err = getDefaultInterfaceBySocket()
|
||||||
return err
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if defaultInterface == nil {
|
||||||
|
return ErrNoRoute
|
||||||
|
}
|
||||||
oldInterface := m.defaultInterfaceName
|
oldInterface := m.defaultInterfaceName
|
||||||
oldIndex := m.defaultInterfaceIndex
|
oldIndex := m.defaultInterfaceIndex
|
||||||
m.defaultInterfaceIndex = defaultInterface.Index
|
m.defaultInterfaceIndex = defaultInterface.Index
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue