2024-11-10 04:11:21 +00:00
|
|
|
package adapter
|
|
|
|
|
|
|
|
import (
|
2024-11-12 11:37:10 +00:00
|
|
|
"time"
|
|
|
|
|
|
|
|
C "github.com/sagernet/sing-box/constant"
|
2024-11-10 04:11:21 +00:00
|
|
|
"github.com/sagernet/sing-tun"
|
|
|
|
"github.com/sagernet/sing/common/control"
|
|
|
|
)
|
|
|
|
|
|
|
|
type NetworkManager interface {
|
2024-11-10 08:46:59 +00:00
|
|
|
Lifecycle
|
2024-11-10 04:11:21 +00:00
|
|
|
InterfaceFinder() control.InterfaceFinder
|
|
|
|
UpdateInterfaces() error
|
2024-11-11 08:23:45 +00:00
|
|
|
DefaultNetworkInterface() *NetworkInterface
|
|
|
|
NetworkInterfaces() []NetworkInterface
|
2024-11-10 04:11:21 +00:00
|
|
|
AutoDetectInterface() bool
|
|
|
|
AutoDetectInterfaceFunc() control.Func
|
2024-11-12 11:37:10 +00:00
|
|
|
ProtectFunc() control.Func
|
|
|
|
DefaultOptions() NetworkOptions
|
2024-11-10 04:11:21 +00:00
|
|
|
RegisterAutoRedirectOutputMark(mark uint32) error
|
|
|
|
AutoRedirectOutputMark() uint32
|
|
|
|
NetworkMonitor() tun.NetworkUpdateMonitor
|
|
|
|
InterfaceMonitor() tun.DefaultInterfaceMonitor
|
|
|
|
PackageManager() tun.PackageManager
|
|
|
|
WIFIState() WIFIState
|
|
|
|
ResetNetwork()
|
|
|
|
}
|
2024-11-11 08:23:45 +00:00
|
|
|
|
2024-11-12 11:37:10 +00:00
|
|
|
type NetworkOptions struct {
|
|
|
|
DefaultNetworkStrategy C.NetworkStrategy
|
|
|
|
DefaultFallbackDelay time.Duration
|
|
|
|
DefaultInterface string
|
|
|
|
DefaultMark uint32
|
|
|
|
}
|
|
|
|
|
2024-11-11 08:23:45 +00:00
|
|
|
type InterfaceUpdateListener interface {
|
|
|
|
InterfaceUpdated()
|
|
|
|
}
|
|
|
|
|
|
|
|
type WIFIState struct {
|
|
|
|
SSID string
|
|
|
|
BSSID string
|
|
|
|
}
|
|
|
|
|
|
|
|
type NetworkInterface struct {
|
|
|
|
control.Interface
|
|
|
|
Type string
|
|
|
|
DNSServers []string
|
|
|
|
Expensive bool
|
|
|
|
Constrained bool
|
|
|
|
}
|