forwarder

package
v0.23.0 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2024 License: MPL-2.0 Imports: 25 Imported by: 1

Documentation

Overview

Package forwarder provides a network session forwarder.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Forwarder

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

Forwarder is a network session forwarder.

func New

func New(ctx context.Context, logger *slog.Logger, srcNet, dstNet network.Network, conf *ForwarderConfig) (*Forwarder, error)

func (*Forwarder) Close

func (f *Forwarder) Close() error

Close closes the forwarder.

func (*Forwarder) ICMPv4ProtocolHandler added in v0.9.0

func (f *Forwarder) ICMPv4ProtocolHandler(id stack.TransportEndpointID, pkt *stack.PacketBuffer) bool

ICMPv4ProtocolHandler forwards ICMPv4 sessions.

func (*Forwarder) ICMPv6ProtocolHandler added in v0.9.0

func (f *Forwarder) ICMPv6ProtocolHandler(id stack.TransportEndpointID, pkt *stack.PacketBuffer) bool

ICMPv6ProtocolHandler forwards ICMPv6 sessions.

func (*Forwarder) TCPProtocolHandler

func (f *Forwarder) TCPProtocolHandler(id stack.TransportEndpointID, pkt *stack.PacketBuffer) bool

TCPProtocolHandler forwards TCP sessions.

func (*Forwarder) UDPProtocolHandler

func (f *Forwarder) UDPProtocolHandler(id stack.TransportEndpointID, pkt *stack.PacketBuffer) bool

UDPProtocolHandler forwards UDP sessions.

func (*Forwarder) ValidDestination added in v0.8.0

func (f *Forwarder) ValidDestination(addr netip.Addr) bool

ValidDestination checks if the destination address is valid for forwarding.

type ForwarderConfig

type ForwarderConfig struct {
	// Allowed destination prefixes.
	AllowedDestinations []netip.Prefix
	// Denied destination prefixes.
	DeniedDestinations []netip.Prefix
	// Maximum number of in-flight TCP connections.
	MaxInFlightTCPConnections *int
	// How long to wait for activity on a UDP session before considering it	dead.
	UDPIdleTimeout *time.Duration
	// How long to wait for an ICMP echo reply before considering it timed out.
	PingTimeout *time.Duration
	// Enable NAT64.
	EnableNAT64 *bool
	// NAT64 prefix.
	NAT64Prefix *netip.Prefix
}

ForwarderConfig is the configuration for the network session forwarder.

Jump to

Keyboard shortcuts

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