Documentation ¶
Index ¶
- Constants
- func TCPForwarder(ctx context.Context, conf *TCPForwarderConfig) func(ipstack *stack.Stack, req *tcp.ForwarderRequest)
- type NetTun
- func (tun *NetTun) BatchSize() int
- func (tun *NetTun) Close() error
- func (tun *NetTun) DialContext(ctx context.Context, network, address string) (net.Conn, error)
- func (tun *NetTun) EnableForwarding(tcpHandler func(*stack.Stack, *tcp.ForwarderRequest), promiscuous bool) error
- func (tun *NetTun) Events() <-chan tun.Event
- func (tun *NetTun) File() *os.File
- func (tun *NetTun) LocalAddresses() []netip.Prefix
- func (tun *NetTun) LookupContextHost(ctx context.Context, host string) ([]string, error)
- func (tun *NetTun) MTU() (int, error)
- func (tun *NetTun) Name() (string, error)
- func (tun *NetTun) Read(buf [][]byte, sizes []int, offset int) (int, error)
- func (tun *NetTun) Write(buf [][]byte, offset int) (int, error)
- func (tun *NetTun) WriteNotify()
- type TCPForwarderConfig
Constants ¶
View Source
const DefaultMTU = 1280 // IPv6 minimum MTU, required for some PPPoE links.
Variables ¶
This section is empty.
Functions ¶
func TCPForwarder ¶
func TCPForwarder(ctx context.Context, conf *TCPForwarderConfig) func(ipstack *stack.Stack, req *tcp.ForwarderRequest)
TCPForwarder forwards TCP connections.
Types ¶
type NetTun ¶
type NetTun struct {
// contains filtered or unexported fields
}
func CreateNetTUN ¶
func (*NetTun) DialContext ¶
DialContext establishes a connection to the specified network and address, resolving the hostname if necessary.
func (*NetTun) EnableForwarding ¶
func (tun *NetTun) EnableForwarding(tcpHandler func(*stack.Stack, *tcp.ForwarderRequest), promiscuous bool) error
EnableForwarding enables packet forwarding on the network interface. Promiscuous mode should be enabled if the network interface is expected to forward packets with a destination address different from the address assigned to the NIC, e.g., when acting as a router.
func (*NetTun) LocalAddresses ¶
LocalAddresses returns the list of local addresses assigned to the NetTun device.
func (*NetTun) LookupContextHost ¶
LookupContextHost resolves the hostname to an IP address.
func (*NetTun) WriteNotify ¶
func (tun *NetTun) WriteNotify()
Click to show internal directories.
Click to hide internal directories.