2022-10-25 12:55:00 +08:00
|
|
|
package platform
|
|
|
|
|
|
|
|
import (
|
2023-04-18 14:04:09 +08:00
|
|
|
"context"
|
2022-10-25 12:55:00 +08:00
|
|
|
|
2023-04-18 14:04:09 +08:00
|
|
|
"github.com/sagernet/sing-box/adapter"
|
2022-10-25 12:55:00 +08:00
|
|
|
"github.com/sagernet/sing-box/common/process"
|
2023-02-28 19:02:27 +08:00
|
|
|
"github.com/sagernet/sing-box/option"
|
2022-10-25 12:55:00 +08:00
|
|
|
"github.com/sagernet/sing-tun"
|
|
|
|
"github.com/sagernet/sing/common/control"
|
2023-07-23 14:42:19 +08:00
|
|
|
"github.com/sagernet/sing/common/logger"
|
2022-10-25 12:55:00 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
type Interface interface {
|
2023-04-18 14:04:09 +08:00
|
|
|
Initialize(ctx context.Context, router adapter.Router) error
|
2023-04-21 17:04:55 +08:00
|
|
|
UsePlatformAutoDetectInterfaceControl() bool
|
2024-11-06 12:51:53 +08:00
|
|
|
AutoDetectInterfaceControl(fd int) error
|
2023-04-17 19:05:02 +08:00
|
|
|
OpenTun(options *tun.Options, platformOptions option.TunPlatformOptions) (tun.Tun, error)
|
2023-04-18 14:04:09 +08:00
|
|
|
UsePlatformDefaultInterfaceMonitor() bool
|
2023-07-23 14:42:19 +08:00
|
|
|
CreateDefaultInterfaceMonitor(logger logger.Logger) tun.DefaultInterfaceMonitor
|
2023-04-18 14:04:09 +08:00
|
|
|
UsePlatformInterfaceGetter() bool
|
2024-04-12 09:24:49 +08:00
|
|
|
Interfaces() ([]control.Interface, error)
|
2023-06-07 21:01:29 +08:00
|
|
|
UnderNetworkExtension() bool
|
2024-05-07 20:34:24 +08:00
|
|
|
IncludeAllNetworks() bool
|
2023-08-24 21:52:38 +08:00
|
|
|
ClearDNSCache()
|
2023-11-24 20:58:07 +08:00
|
|
|
ReadWIFIState() adapter.WIFIState
|
2022-10-25 12:55:00 +08:00
|
|
|
process.Searcher
|
2024-11-06 12:51:53 +08:00
|
|
|
SendNotification(notification *Notification) error
|
|
|
|
}
|
|
|
|
|
|
|
|
type Notification struct {
|
|
|
|
Identifier string
|
|
|
|
TypeName string
|
|
|
|
TypeID int32
|
|
|
|
Title string
|
|
|
|
Subtitle string
|
|
|
|
Body string
|
|
|
|
OpenURL string
|
2022-10-25 12:55:00 +08:00
|
|
|
}
|