forwarder

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2026 License: Apache-2.0 Imports: 33 Imported by: 6

Documentation

Index

Constants

View Source
const (
	// UDPConnTrackTimeout is the timeout used for UDP connection tracking
	UDPConnTrackTimeout = 90 * time.Second
	// UDPBufSize is the buffer size for the UDP proxy
	UDPBufSize = 65507
)

Variables

This section is empty.

Functions

func TCP

func TCP(s *stack.Stack, nat map[tcpip.Address]tcpip.Address, natLock *sync.Mutex, ec2MetadataAccess bool, maxInFlight int, connectTimeout time.Duration) *tcp.Forwarder

func UDP

func UDP(s *stack.Stack, nat map[tcpip.Address]tcpip.Address, natLock *sync.Mutex, ec2MetadataAccess bool) *udp.Forwarder

Types

type CloseWrapper added in v0.4.0

type CloseWrapper func() error

func (CloseWrapper) Close added in v0.4.0

func (w CloseWrapper) Close() error

type Forwarder added in v0.9.0

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

func ICMP added in v0.9.0

func ICMP(s *stack.Stack, nat map[tcpip.Address]tcpip.Address, natLock *sync.Mutex) *Forwarder

func NewForwarder added in v0.9.0

func NewForwarder(s *stack.Stack, handler func(*ICMPForwarderRequest)) *Forwarder

NewForwarder allocates and initializes a new forwarder.

func (*Forwarder) HandlePacket added in v0.9.0

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

HandlePacket handles all packets.

This function is expected to be passed as an argument to the stack.SetTransportProtocolHandler function.

type ICMPForwarderRequest added in v0.9.0

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

ICMPForwarderRequest represents a request to forward an ICMP packet.

func NewICMPForwarderRequest added in v0.9.0

func NewICMPForwarderRequest(s *stack.Stack, id stack.TransportEndpointID, pkt *stack.PacketBuffer) *ICMPForwarderRequest

NewICMPForwarderRequest creates a new ICMP forwarder request.

func (*ICMPForwarderRequest) CreateEndpoint added in v0.9.0

func (f *ICMPForwarderRequest) CreateEndpoint(s *stack.Stack, wq *waiter.Queue) (tcpip.Endpoint, tcpip.Error)

CreateEndpoint creates a new endpoint for this forwarder request.

func (*ICMPForwarderRequest) ID added in v0.9.0

ID returns the 4-tuple (src address, src port, dst address, dst port) that represents the connection request.

func (*ICMPForwarderRequest) Packet added in v0.9.0

Packet returns the packet buffer associated with this forwarder request.

type PortsForwarder

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

func NewPortsForwarder

func NewPortsForwarder(s *stack.Stack) *PortsForwarder

func (*PortsForwarder) Close added in v0.9.0

func (f *PortsForwarder) Close() error

func (*PortsForwarder) Expose

func (f *PortsForwarder) Expose(protocol types.TransportProtocol, local, remote string) error

func (*PortsForwarder) Mux

func (f *PortsForwarder) Mux() http.Handler

func (*PortsForwarder) Unexpose

func (f *PortsForwarder) Unexpose(protocol types.TransportProtocol, local string) error

type ProxyKey added in v0.8.2

type ProxyKey string

type UDPProxy added in v0.2.0

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

UDPProxy is proxy for which handles UDP datagrams. It implements the Proxy interface to handle UDP traffic forwarding between the frontend and backend addresses.

func NewUDPProxy added in v0.2.0

func NewUDPProxy(listener udpConn, dialer func(from net.Addr) (net.Conn, error)) (*UDPProxy, error)

NewUDPProxy creates a new UDPProxy.

func (*UDPProxy) Close added in v0.2.0

func (proxy *UDPProxy) Close() error

Close stops forwarding the traffic.

func (*UDPProxy) Run added in v0.2.0

func (proxy *UDPProxy) Run()

Run starts forwarding the traffic using UDP.

Jump to

Keyboard shortcuts

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