Add DefaultInterfaceMonitor.MyInterface
This commit is contained in:
parent
2121bc3f01
commit
f57754918d
5 changed files with 19 additions and 2 deletions
|
|
@ -42,11 +42,12 @@ type defaultInterfaceMonitor struct {
|
|||
androidVPNEnabled bool
|
||||
noRoute bool
|
||||
networkMonitor NetworkUpdateMonitor
|
||||
logger logger.Logger
|
||||
checkUpdateTimer *time.Timer
|
||||
element *list.Element[NetworkUpdateCallback]
|
||||
access sync.Mutex
|
||||
callbacks list.List[DefaultInterfaceUpdateCallback]
|
||||
logger logger.Logger
|
||||
myInterface string
|
||||
}
|
||||
|
||||
func NewDefaultInterfaceMonitor(networkMonitor NetworkUpdateMonitor, logger logger.Logger, options DefaultInterfaceMonitorOptions) (DefaultInterfaceMonitor, error) {
|
||||
|
|
@ -132,3 +133,15 @@ func (m *defaultInterfaceMonitor) emit(defaultInterface *control.Interface, flag
|
|||
callback(defaultInterface, flags)
|
||||
}
|
||||
}
|
||||
|
||||
func (m *defaultInterfaceMonitor) RegisterMyInterface(interfaceName string) {
|
||||
m.access.Lock()
|
||||
defer m.access.Unlock()
|
||||
m.myInterface = interfaceName
|
||||
}
|
||||
|
||||
func (m *defaultInterfaceMonitor) MyInterface() string {
|
||||
m.access.Lock()
|
||||
defer m.access.Unlock()
|
||||
return m.myInterface
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue