Documentation ¶
Index ¶
- Constants
- Variables
- func CalculateInterfaceName(name string) (tunName string)
- func NetworkFromName(name string) uint8
- func NetworkName(network uint8) string
- type DefaultInterfaceMonitor
- type DefaultInterfaceMonitorOptions
- type DefaultInterfaceUpdateCallback
- type Handler
- type NativeTun
- type NetworkUpdateCallback
- type NetworkUpdateMonitor
- type Options
- type PackageManager
- type PackageManagerCallback
- type Session
- type Stack
- type StackOptions
- type System
- type TCPNat
- type TCPSession
- type Tun
- type WinTun
Constants ¶
View Source
const ( EventInterfaceUpdate = 1 EventAndroidVPNUpdate = 2 EventNoRoute = 4 )
View Source
const PacketOffset = 0
View Source
const WithGVisor = false
Variables ¶
View Source
var ErrGVisorNotIncluded = E.New(`gVisor is not included in this build, rebuild with -tags with_gvisor`)
View Source
var ErrNoRoute = E.New("no route to internet")
Functions ¶
func CalculateInterfaceName ¶
func NetworkFromName ¶
func NetworkName ¶
Types ¶
type DefaultInterfaceMonitor ¶
type DefaultInterfaceMonitor interface { Start() error Close() error DefaultInterfaceName(destination netip.Addr) string DefaultInterfaceIndex(destination netip.Addr) int DefaultInterface(destination netip.Addr) (string, int) OverrideAndroidVPN() bool AndroidVPNEnabled() bool RegisterCallback(callback DefaultInterfaceUpdateCallback) *list.Element[DefaultInterfaceUpdateCallback] UnregisterCallback(element *list.Element[DefaultInterfaceUpdateCallback]) }
func NewDefaultInterfaceMonitor ¶
func NewDefaultInterfaceMonitor(networkMonitor NetworkUpdateMonitor, logger logger.Logger, options DefaultInterfaceMonitorOptions) (DefaultInterfaceMonitor, error)
type DefaultInterfaceUpdateCallback ¶
type DefaultInterfaceUpdateCallback = func(event int)
type Handler ¶
type Handler interface { N.TCPConnectionHandler N.UDPConnectionHandler E.Handler }
type NativeTun ¶
type NativeTun struct {
// contains filtered or unexported fields
}
func (*NativeTun) CreateVectorisedWriter ¶
func (t *NativeTun) CreateVectorisedWriter() N.VectorisedWriter
type NetworkUpdateCallback ¶
type NetworkUpdateCallback = func()
type NetworkUpdateMonitor ¶
type NetworkUpdateMonitor interface { Start() error Close() error RegisterCallback(callback NetworkUpdateCallback) *list.Element[NetworkUpdateCallback] UnregisterCallback(element *list.Element[NetworkUpdateCallback]) }
func NewNetworkUpdateMonitor ¶
func NewNetworkUpdateMonitor(logger logger.Logger) (NetworkUpdateMonitor, error)
type Options ¶
type Options struct { Name string Inet4Address []netip.Prefix Inet6Address []netip.Prefix MTU uint32 AutoRoute bool StrictRoute bool Inet4RouteAddress []netip.Prefix Inet6RouteAddress []netip.Prefix IncludeInterface []string ExcludeInterface []string IncludeUID []ranges.Range[uint32] ExcludeUID []ranges.Range[uint32] IncludeAndroidUser []int IncludePackage []string ExcludePackage []string InterfaceMonitor DefaultInterfaceMonitor TableIndex int FileDescriptor int Logger logger.Logger }
func (*Options) BuildAndroidRules ¶
func (o *Options) BuildAndroidRules(packageManager PackageManager, errorHandler E.Handler)
type PackageManager ¶
type PackageManager interface { Start() error Close() error IDByPackage(packageName string) (uint32, bool) PackageByID(id uint32) (string, bool) }
func NewPackageManager ¶
func NewPackageManager(callback PackageManagerCallback) (PackageManager, error)
type PackageManagerCallback ¶
type Stack ¶
func NewGVisor ¶
func NewGVisor( options StackOptions, ) (Stack, error)
func NewLWIP ¶
func NewLWIP( options StackOptions, ) (Stack, error)
func NewMixed ¶
func NewMixed( options StackOptions, ) (Stack, error)
func NewSystem ¶
func NewSystem(options StackOptions) (Stack, error)
type StackOptions ¶
type TCPNat ¶
type TCPNat struct {
// contains filtered or unexported fields
}
func (*TCPNat) LookupBack ¶
func (n *TCPNat) LookupBack(port uint16) *TCPSession
type TCPSession ¶
type Tun ¶
type Tun interface { io.ReadWriter CreateVectorisedWriter() N.VectorisedWriter Close() error }
Source Files ¶
Click to show internal directories.
Click to hide internal directories.