mirror of
https://github.com/SagerNet/sing-box.git
synced 2024-12-27 02:35:38 +08:00
35 lines
921 B
Go
35 lines
921 B
Go
package platform
|
|
|
|
import (
|
|
"context"
|
|
"io"
|
|
"net/netip"
|
|
|
|
"github.com/sagernet/sing-box/adapter"
|
|
"github.com/sagernet/sing-box/common/process"
|
|
"github.com/sagernet/sing-box/option"
|
|
"github.com/sagernet/sing-tun"
|
|
"github.com/sagernet/sing/common/control"
|
|
E "github.com/sagernet/sing/common/exceptions"
|
|
)
|
|
|
|
type Interface interface {
|
|
Initialize(ctx context.Context, router adapter.Router) error
|
|
UsePlatformAutoDetectInterfaceControl() bool
|
|
AutoDetectInterfaceControl() control.Func
|
|
OpenTun(options *tun.Options, platformOptions option.TunPlatformOptions) (tun.Tun, error)
|
|
UsePlatformDefaultInterfaceMonitor() bool
|
|
CreateDefaultInterfaceMonitor(errorHandler E.Handler) tun.DefaultInterfaceMonitor
|
|
UsePlatformInterfaceGetter() bool
|
|
Interfaces() ([]NetworkInterface, error)
|
|
process.Searcher
|
|
io.Writer
|
|
}
|
|
|
|
type NetworkInterface struct {
|
|
Index int
|
|
MTU int
|
|
Name string
|
|
Addresses []netip.Prefix
|
|
}
|