interface.go 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  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. CreateDefaultInterfaceMonitor(logger logger.Logger) tun.DefaultInterfaceMonitor
  15. Interfaces() ([]adapter.NetworkInterface, error)
  16. UnderNetworkExtension() bool
  17. IncludeAllNetworks() bool
  18. ClearDNSCache()
  19. ReadWIFIState() adapter.WIFIState
  20. SystemCertificates() []string
  21. process.Searcher
  22. SendNotification(notification *Notification) error
  23. }
  24. type Notification struct {
  25. Identifier string
  26. TypeName string
  27. TypeID int32
  28. Title string
  29. Subtitle string
  30. Body string
  31. OpenURL string
  32. Clipboard string
  33. MediaURL string
  34. MediaData []byte
  35. MediaType string
  36. Timeout int
  37. }