github.com/sagernet/sing-box@v1.2.7/experimental/libbox/platform/interface.go (about) 1 package platform 2 3 import ( 4 "context" 5 "io" 6 "net/netip" 7 8 "github.com/sagernet/sing-box/adapter" 9 "github.com/sagernet/sing-box/common/process" 10 "github.com/sagernet/sing-box/option" 11 "github.com/sagernet/sing-tun" 12 "github.com/sagernet/sing/common/control" 13 E "github.com/sagernet/sing/common/exceptions" 14 ) 15 16 type Interface interface { 17 Initialize(ctx context.Context, router adapter.Router) error 18 UsePlatformAutoDetectInterfaceControl() bool 19 AutoDetectInterfaceControl() control.Func 20 OpenTun(options *tun.Options, platformOptions option.TunPlatformOptions) (tun.Tun, error) 21 UsePlatformDefaultInterfaceMonitor() bool 22 CreateDefaultInterfaceMonitor(errorHandler E.Handler) tun.DefaultInterfaceMonitor 23 UsePlatformInterfaceGetter() bool 24 Interfaces() ([]NetworkInterface, error) 25 process.Searcher 26 io.Writer 27 } 28 29 type NetworkInterface struct { 30 Index int 31 MTU int 32 Name string 33 Addresses []netip.Prefix 34 }