interface.go 1.1 KB

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