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 )
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 OverrideAndroidVPN() bool AndroidVPNEnabled() bool RegisterCallback(callback DefaultInterfaceUpdateCallback) *list.Element[DefaultInterfaceUpdateCallback] UnregisterCallback(element *list.Element[DefaultInterfaceUpdateCallback]) }
func NewDefaultInterfaceMonitor ¶
func NewDefaultInterfaceMonitor(networkMonitor NetworkUpdateMonitor, options DefaultInterfaceMonitorOptions) (DefaultInterfaceMonitor, error)
type Handler ¶
type Handler interface { N.TCPConnectionHandler N.UDPConnectionHandler E.Handler }
type NetworkUpdateCallback ¶
type NetworkUpdateCallback = func() error
type NetworkUpdateMonitor ¶
type NetworkUpdateMonitor interface { Start() error Close() error RegisterCallback(callback NetworkUpdateCallback) *list.Element[NetworkUpdateCallback] UnregisterCallback(element *list.Element[NetworkUpdateCallback]) E.Handler }
func NewNetworkUpdateMonitor ¶
func NewNetworkUpdateMonitor(errorHandler E.Handler) (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 IncludeUID []ranges.Range[uint32] ExcludeUID []ranges.Range[uint32] IncludeAndroidUser []int IncludePackage []string ExcludePackage []string InterfaceMonitor DefaultInterfaceMonitor TableIndex int FileDescriptor int }
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 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 Close() error }
Source Files ¶
Click to show internal directories.
Click to hide internal directories.