github.com/inazumav/sing-box@v0.0.0-20230926072359-ab51429a14f1/experimental/libbox/platform/interface.go (about)

     1  package platform
     2  
     3  import (
     4  	"context"
     5  	"io"
     6  	"net/netip"
     7  
     8  	"github.com/inazumav/sing-box/adapter"
     9  	"github.com/inazumav/sing-box/common/process"
    10  	"github.com/inazumav/sing-box/option"
    11  	"github.com/sagernet/sing-tun"
    12  	"github.com/sagernet/sing/common/control"
    13  	"github.com/sagernet/sing/common/logger"
    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(logger logger.Logger) tun.DefaultInterfaceMonitor
    23  	UsePlatformInterfaceGetter() bool
    24  	Interfaces() ([]NetworkInterface, error)
    25  	UnderNetworkExtension() bool
    26  	ClearDNSCache()
    27  	process.Searcher
    28  	io.Writer
    29  }
    30  
    31  type NetworkInterface struct {
    32  	Index     int
    33  	MTU       int
    34  	Name      string
    35  	Addresses []netip.Prefix
    36  }