mirror of
https://github.com/SagerNet/sing-tun.git
synced 2025-04-03 03:47:39 +03:00
Improve monitor api
This commit is contained in:
parent
2a1554dfd3
commit
7ee0d19103
8 changed files with 110 additions and 192 deletions
|
@ -9,7 +9,7 @@ var ErrNoRoute = E.New("no route to internet")
|
|||
|
||||
type (
|
||||
NetworkUpdateCallback = func() error
|
||||
DefaultInterfaceUpdateCallback = func()
|
||||
DefaultInterfaceUpdateCallback = func() error
|
||||
)
|
||||
|
||||
type NetworkUpdateMonitor interface {
|
||||
|
@ -17,6 +17,7 @@ type NetworkUpdateMonitor interface {
|
|||
Close() error
|
||||
RegisterCallback(callback NetworkUpdateCallback) *list.Element[NetworkUpdateCallback]
|
||||
UnregisterCallback(element *list.Element[NetworkUpdateCallback])
|
||||
E.Handler
|
||||
}
|
||||
|
||||
type DefaultInterfaceMonitor interface {
|
||||
|
@ -24,4 +25,6 @@ type DefaultInterfaceMonitor interface {
|
|||
Close() error
|
||||
DefaultInterfaceName() string
|
||||
DefaultInterfaceIndex() int
|
||||
RegisterCallback(callback DefaultInterfaceUpdateCallback) *list.Element[DefaultInterfaceUpdateCallback]
|
||||
UnregisterCallback(element *list.Element[DefaultInterfaceUpdateCallback])
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue