netstack

package
v2.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2025 License: GPL-3.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConnPool

type ConnPool struct {
	CloseChan chan interface{}
	Pool      chan TunConn
	sync.Mutex
}

func NewConnPool

func NewConnPool(size int) *ConnPool

func (*ConnPool) Add

func (p *ConnPool) Add(packet TunConn) error

func (*ConnPool) Close

func (p *ConnPool) Close() error

func (*ConnPool) Closed

func (p *ConnPool) Closed() bool

func (*ConnPool) Get

func (p *ConnPool) Get() (TunConn, error)

type ICMPConn

type ICMPConn struct {
	Request stack.PacketBuffer
}

ICMPConn represents a ICMP Packet Buffer

type NetStack

type NetStack struct {
	sync.Mutex
	// contains filtered or unexported fields
}

NetStack is the structure used to store the connection pool and the gvisor network stack

func NewNetstack

func NewNetstack(maxConnections int, maxInFlight int, tunName string) (*NetStack, error)

func (*NetStack) ClosePool

func (s *NetStack) ClosePool() <-chan interface{}

func (*NetStack) Destroy

func (s *NetStack) Destroy() error

Cleans up after gVisor. Couldn't find a better way

func (*NetStack) GetStack

func (s *NetStack) GetStack() *stack.Stack

GetStack returns the current Gvisor stack.Stack object

func (*NetStack) GetTunConn

func (s *NetStack) GetTunConn() <-chan TunConn

func (*NetStack) HandlePacket

func (ns *NetStack) HandlePacket(localConn TunConn, multiplex *yamux.Session, localRoutes []route.Route)

func (*NetStack) ProcessICMP

func (ns *NetStack) ProcessICMP(pkt *stack.PacketBuffer)

ProcessICMP send back a ICMP echo reply from after receiving a echo request. This code come mostly from pkg/tcpip/network/ipv4/icmp.go

func (*NetStack) SetConnPool

func (s *NetStack) SetConnPool(connPool *ConnPool)

SetConnPool is used to change the current connPool. It must be used after switching Ligolo agents

type TCPConn

type TCPConn struct {
	EndpointID stack.TransportEndpointID
	Request    *tcp.ForwarderRequest
}

TCPConn represents a TCP Forwarder connection

type TunConn

type TunConn struct {
	Protocol tcpip.TransportProtocolNumber
	Handler  interface{}
}

func (TunConn) GetICMP

func (t TunConn) GetICMP() ICMPConn

GetICMP returns the handler as a ICMPConn

func (TunConn) GetTCP

func (t TunConn) GetTCP() TCPConn

GetTCP returns the handler as a TCPConn

func (TunConn) GetUDP

func (t TunConn) GetUDP() UDPConn

GetUDP returns the handler as a UDPConn

func (TunConn) IsICMP

func (t TunConn) IsICMP() bool

IsICMP check if the current TunConn is ICMP

func (TunConn) IsTCP

func (t TunConn) IsTCP() bool

IsTCP check if the current TunConn is TCP

func (TunConn) IsUDP

func (t TunConn) IsUDP() bool

IsUDP check if the current TunConn is UDP

func (TunConn) Terminate

func (t TunConn) Terminate(reset bool)

Terminate is call when connections need to be terminated. For now, this is only useful for TCP connections

type UDPConn

type UDPConn struct {
	EndpointID stack.TransportEndpointID
	Request    *udp.ForwarderRequest
}

UDPConn represents a UDP Forwarder connection

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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