interface.go 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  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/control"
  8. "github.com/sagernet/sing/common/logger"
  9. )
  10. type Interface interface {
  11. Initialize(networkManager adapter.NetworkManager) error
  12. UsePlatformAutoDetectInterfaceControl() bool
  13. AutoDetectInterfaceControl(fd int) error
  14. OpenTun(options *tun.Options, platformOptions option.TunPlatformOptions) (tun.Tun, error)
  15. UsePlatformDefaultInterfaceMonitor() bool
  16. CreateDefaultInterfaceMonitor(logger logger.Logger) tun.DefaultInterfaceMonitor
  17. UsePlatformInterfaceGetter() bool
  18. Interfaces() ([]control.Interface, error)
  19. UnderNetworkExtension() bool
  20. IncludeAllNetworks() bool
  21. ClearDNSCache()
  22. ReadWIFIState() adapter.WIFIState
  23. process.Searcher
  24. SendNotification(notification *Notification) error
  25. }
  26. type Notification struct {
  27. Identifier string
  28. TypeName string
  29. TypeID int32
  30. Title string
  31. Subtitle string
  32. Body string
  33. OpenURL string
  34. }