interface.go 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  1. package platform
  2. import (
  3. "github.com/sagernet/sing-box/adapter"
  4. "github.com/sagernet/sing-box/common/process"
  5. "github.com/sagernet/sing-box/option"
  6. "github.com/sagernet/sing-tun"
  7. "github.com/sagernet/sing/common/logger"
  8. )
  9. type Interface interface {
  10. Initialize(networkManager adapter.NetworkManager) error
  11. UsePlatformAutoDetectInterfaceControl() bool
  12. AutoDetectInterfaceControl(fd int) error
  13. OpenTun(options *tun.Options, platformOptions option.TunPlatformOptions) (tun.Tun, error)
  14. UpdateRouteOptions(options *tun.Options, platformOptions option.TunPlatformOptions) error
  15. CreateDefaultInterfaceMonitor(logger logger.Logger) tun.DefaultInterfaceMonitor
  16. Interfaces() ([]adapter.NetworkInterface, error)
  17. SetUnderlyingNetworks(networks []adapter.NetworkInterface) error
  18. UnderNetworkExtension() bool
  19. IncludeAllNetworks() bool
  20. ClearDNSCache()
  21. ReadWIFIState() adapter.WIFIState
  22. process.Searcher
  23. SendNotification(notification *Notification) error
  24. }
  25. type Notification struct {
  26. Identifier string
  27. TypeName string
  28. TypeID int32
  29. Title string
  30. Subtitle string
  31. Body string
  32. OpenURL string
  33. }