sing-tun/monitor.go
2022-07-15 14:59:26 +08:00

27 lines
618 B
Go

package tun
import (
E "github.com/sagernet/sing/common/exceptions"
"github.com/sagernet/sing/common/x/list"
)
var ErrNoRoute = E.New("no route to internet")
type (
NetworkUpdateCallback = func() error
DefaultInterfaceUpdateCallback = func()
)
type NetworkUpdateMonitor interface {
Start() error
Close() error
RegisterCallback(callback NetworkUpdateCallback) *list.Element[NetworkUpdateCallback]
UnregisterCallback(element *list.Element[NetworkUpdateCallback])
}
type DefaultInterfaceMonitor interface {
Start() error
Close() error
DefaultInterfaceName() string
DefaultInterfaceIndex() int
}