mirror of
https://github.com/SagerNet/sing-tun.git
synced 2025-04-03 03:47:39 +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 {
|
||||
OverrideAndroidVPN bool
|
||||
OverrideAndroidVPN bool
|
||||
UnderNetworkExtension bool
|
||||
}
|
||||
|
|
|
@ -122,11 +122,16 @@ func (m *defaultInterfaceMonitor) checkUpdate() error {
|
|||
break
|
||||
}
|
||||
if defaultInterface == nil {
|
||||
defaultInterface, err = getDefaultInterfaceBySocket()
|
||||
if err != nil {
|
||||
return err
|
||||
if m.options.UnderNetworkExtension {
|
||||
defaultInterface, err = getDefaultInterfaceBySocket()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
if defaultInterface == nil {
|
||||
return ErrNoRoute
|
||||
}
|
||||
oldInterface := m.defaultInterfaceName
|
||||
oldIndex := m.defaultInterfaceIndex
|
||||
m.defaultInterfaceIndex = defaultInterface.Index
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue