mirror of
https://github.com/SagerNet/sing-box.git
synced 2026-04-13 20:28:32 +10:00
Align dev-next-grpc with wip2 by adding UsePlatformWIFIMonitor() to the new PlatformInterface, allowing platform clients to indicate they handle WIFI monitoring themselves.
71 lines
1.6 KiB
Go
71 lines
1.6 KiB
Go
package adapter
|
|
|
|
import (
|
|
"github.com/sagernet/sing-box/option"
|
|
"github.com/sagernet/sing-tun"
|
|
"github.com/sagernet/sing/common/logger"
|
|
)
|
|
|
|
type PlatformInterface interface {
|
|
Initialize(networkManager NetworkManager) error
|
|
|
|
UsePlatformAutoDetectInterfaceControl() bool
|
|
AutoDetectInterfaceControl(fd int) error
|
|
|
|
UsePlatformInterface() bool
|
|
OpenInterface(options *tun.Options, platformOptions option.TunPlatformOptions) (tun.Tun, error)
|
|
|
|
UsePlatformDefaultInterfaceMonitor() bool
|
|
CreateDefaultInterfaceMonitor(logger logger.Logger) tun.DefaultInterfaceMonitor
|
|
|
|
UsePlatformNetworkInterfaces() bool
|
|
NetworkInterfaces() ([]NetworkInterface, error)
|
|
|
|
UnderNetworkExtension() bool
|
|
NetworkExtensionIncludeAllNetworks() bool
|
|
|
|
ClearDNSCache()
|
|
RequestPermissionForWIFIState() error
|
|
ReadWIFIState() WIFIState
|
|
SystemCertificates() []string
|
|
|
|
UsePlatformConnectionOwnerFinder() bool
|
|
FindConnectionOwner(request *FindConnectionOwnerRequest) (*ConnectionOwner, error)
|
|
|
|
UsePlatformWIFIMonitor() bool
|
|
|
|
UsePlatformNotification() bool
|
|
SendNotification(notification *Notification) error
|
|
}
|
|
|
|
type FindConnectionOwnerRequest struct {
|
|
IpProtocol int32
|
|
SourceAddress string
|
|
SourcePort int32
|
|
DestinationAddress string
|
|
DestinationPort int32
|
|
}
|
|
|
|
type ConnectionOwner struct {
|
|
ProcessID uint32
|
|
UserId int32
|
|
UserName string
|
|
ProcessPath string
|
|
AndroidPackageName string
|
|
}
|
|
|
|
type Notification struct {
|
|
Identifier string
|
|
TypeName string
|
|
TypeID int32
|
|
Title string
|
|
Subtitle string
|
|
Body string
|
|
OpenURL string
|
|
}
|
|
|
|
type SystemProxyStatus struct {
|
|
Available bool
|
|
Enabled bool
|
|
}
|