netstack

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2022 License: GPL-3.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HandlePacket

func HandlePacket(nstack *stack.Stack, localConn TunConn, yamuxConn *yamux.Session)

func ProcessICMP

func ProcessICMP(nstack *stack.Stack, 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

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 NewStack

func NewStack(tunName string, connPool *ConnPool) *NetStack

NewStack registers a new GVisor Network Stack

func (*NetStack) GetStack

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

GetStack returns the current Gvisor stack.Stack object

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