control

package
v0.6.0-alpha.16 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 16, 2024 License: GPL-2.0 Imports: 13 Imported by: 134

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BindToInterface0

func BindToInterface0(finder InterfaceFinder, conn syscall.RawConn, network string, address string, interfaceName string, interfaceIndex int, preferInterfaceName bool) error

func Conn

func Conn(conn syscall.Conn, block func(fd uintptr) error) error

func Conn0 added in v0.5.0

func Conn0[T any](conn syscall.Conn, block func(fd uintptr) (T, error)) (T, error)

func GetOriginalDestination added in v0.5.0

func GetOriginalDestination(conn net.Conn) (netip.AddrPort, error)

func GetOriginalDestinationFromOOB added in v0.5.0

func GetOriginalDestinationFromOOB(oob []byte) (netip.AddrPort, error)

func Raw

func Raw(rawConn syscall.RawConn, block func(fd uintptr) error) error

func Raw0 added in v0.5.0

func Raw0[T any](rawConn syscall.RawConn, block func(fd uintptr) (T, error)) (T, error)

func TProxy added in v0.5.0

func TProxy(fd uintptr, family int) error

Types

type DefaultInterfaceFinder

type DefaultInterfaceFinder struct {
	// contains filtered or unexported fields
}

func NewDefaultInterfaceFinder added in v0.4.0

func NewDefaultInterfaceFinder() *DefaultInterfaceFinder

func (*DefaultInterfaceFinder) ByAddr

func (f *DefaultInterfaceFinder) ByAddr(addr netip.Addr) (*Interface, error)

func (*DefaultInterfaceFinder) ByIndex

func (f *DefaultInterfaceFinder) ByIndex(index int) (*Interface, error)

func (*DefaultInterfaceFinder) ByName

func (f *DefaultInterfaceFinder) ByName(name string) (*Interface, error)

func (*DefaultInterfaceFinder) Interfaces added in v0.5.0

func (f *DefaultInterfaceFinder) Interfaces() []Interface

func (*DefaultInterfaceFinder) Update added in v0.4.0

func (f *DefaultInterfaceFinder) Update() error

func (*DefaultInterfaceFinder) UpdateInterfaces added in v0.4.0

func (f *DefaultInterfaceFinder) UpdateInterfaces(interfaces []Interface)

type Func

type Func = func(network, address string, conn syscall.RawConn) error

func Append

func Append(oldFunc Func, newFunc Func) Func

func BindToInterface

func BindToInterface(finder InterfaceFinder, interfaceName string, interfaceIndex int) Func

func BindToInterfaceFunc

func BindToInterfaceFunc(finder InterfaceFinder, block func(network string, address string) (interfaceName string, interfaceIndex int, err error)) Func

func DisableUDPFragment

func DisableUDPFragment() Func

func ProtectPath

func ProtectPath(protectPath string) Func

func ReuseAddr

func ReuseAddr() Func

func RoutingMark

func RoutingMark(mark uint32) Func

func SetKeepAlivePeriod added in v0.4.0

func SetKeepAlivePeriod(idle time.Duration, interval time.Duration) Func

func TProxyWriteBack added in v0.5.0

func TProxyWriteBack() Func

type Interface added in v0.4.0

type Interface struct {
	Index        int
	MTU          int
	Name         string
	HardwareAddr net.HardwareAddr
	Flags        net.Flags
	Addresses    []netip.Prefix
}

func InterfaceFromNet

func InterfaceFromNet(iif net.Interface) (Interface, error)

func InterfaceFromNetAddrs

func InterfaceFromNetAddrs(iif net.Interface, addresses []netip.Prefix) Interface

func (Interface) Equals

func (i Interface) Equals(other Interface) bool

func (Interface) NetInterface

func (i Interface) NetInterface() net.Interface

type InterfaceFinder

type InterfaceFinder interface {
	Update() error
	Interfaces() []Interface
	ByName(name string) (*Interface, error)
	ByIndex(index int) (*Interface, error)
	ByAddr(addr netip.Addr) (*Interface, error)
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL