netstack

package
v0.9.3 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2025 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const IPv6MinMTU = 1280 // IPv6 minimum MTU, required for some PPPoE links.

Variables

This section is empty.

Functions

This section is empty.

Types

type ProtocolHandler

type ProtocolHandler func(stack.TransportEndpointID, *stack.PacketBuffer) bool

ProtocolHandler is a function that handles packets for a specific protocol.

func TCPForwarder

func TCPForwarder(ctx context.Context, ipstack *stack.Stack, upstream network.Network) ProtocolHandler

TCPForwarder forwards TCP connections to an upstream network.

type TunDevice

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

func NewTunDevice

func NewTunDevice(localAddresses []netip.Prefix, pcapPath string) (*TunDevice, error)

func (*TunDevice) BatchSize

func (tun *TunDevice) BatchSize() int

func (*TunDevice) Close

func (tun *TunDevice) Close() error

func (*TunDevice) Events

func (tun *TunDevice) Events() <-chan tun.Event

func (*TunDevice) File

func (tun *TunDevice) File() *os.File

func (*TunDevice) ForwardTo

func (tun *TunDevice) ForwardTo(ctx context.Context, upstream network.Network) error

ForwardTo forwards all inbound traffic to the upstream network.

func (*TunDevice) LocalAddresses

func (tun *TunDevice) LocalAddresses() ([]netip.Prefix, error)

LocalAddresses returns the list of local addresses assigned to the TUN device.

func (*TunDevice) MTU

func (tun *TunDevice) MTU() (int, error)

func (*TunDevice) Name

func (tun *TunDevice) Name() (string, error)

func (*TunDevice) Network

func (tun *TunDevice) Network(resolveConf *network.ResolveConfig) *network.NetstackNetwork

Network returns the network abstraction for the TUN device.

func (*TunDevice) Read

func (tun *TunDevice) Read(buf [][]byte, sizes []int, offset int) (int, error)

func (*TunDevice) Write

func (tun *TunDevice) Write(buf [][]byte, offset int) (int, error)

func (*TunDevice) WriteNotify

func (tun *TunDevice) WriteNotify()

Jump to

Keyboard shortcuts

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