gvisor

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2025 License: AGPL-3.0 Imports: 33 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewLinkWriterToWriter

func NewLinkWriterToWriter(writer stack.LinkWriter) io.Writer

Types

type FilterLinkEndpoint

type FilterLinkEndpoint struct {
	stack.LinkEndpoint
	// contains filtered or unexported fields
}

func NewFilterLinkEndpoint

func NewFilterLinkEndpoint(linkEndpoint stack.LinkEndpoint, reject inboundcommon.Rejector, retainUdp bool) *FilterLinkEndpoint

func (*FilterLinkEndpoint) Attach

func (l *FilterLinkEndpoint) Attach(dispatcher stack.NetworkDispatcher)

func (*FilterLinkEndpoint) DeliverLinkPacket

func (f *FilterLinkEndpoint) DeliverLinkPacket(protocol tcpip.NetworkProtocolNumber, pkt *stack.PacketBuffer)

func (*FilterLinkEndpoint) DeliverNetworkPacket

func (d *FilterLinkEndpoint) DeliverNetworkPacket(protocol tcpip.NetworkProtocolNumber, pkt *stack.PacketBuffer)

TODO: use dns conn

func (*FilterLinkEndpoint) ReadPacket

func (d *FilterLinkEndpoint) ReadPacket() (*buf.Buffer, error)

func (*FilterLinkEndpoint) WritePacket

func (d *FilterLinkEndpoint) WritePacket(p *buf.Buffer) error

type FilterLinkEndpointToTunDevice

type FilterLinkEndpointToTunDevice struct {
	*FilterLinkEndpoint
	// contains filtered or unexported fields
}

func NewFilterLinkEndpointToRunnable

func NewFilterLinkEndpointToRunnable(linkEndpoint *FilterLinkEndpoint, name string) *FilterLinkEndpointToTunDevice

func (*FilterLinkEndpointToTunDevice) Close

func (*FilterLinkEndpointToTunDevice) Name

func (*FilterLinkEndpointToTunDevice) Start

type GvisorInboundOption

type GvisorInboundOption struct {
	// Fd int
	// Name string
	Tag string
	i.Handler
	stack.LinkEndpoint
	TcpOnly bool
	UdpOnly bool
	OnClose func()
}

type IOLinkEndpoint

type IOLinkEndpoint struct {
	*channel.Endpoint
	// contains filtered or unexported fields
}

Read packets from ReadWriter, send the packets to gvisor stack; meanwhile, read packets from gvisor stack, write the packets to ReadWriter rw is owned by IOLinkEndpoint

func NewIOLinkEndpoint

func NewIOLinkEndpoint(rw io.ReadWriteCloser, opts ...IOLinkEndpointOption) *IOLinkEndpoint

rw's ownership is transfered

func (*IOLinkEndpoint) Close

func (e *IOLinkEndpoint) Close()

func (*IOLinkEndpoint) Start

func (e *IOLinkEndpoint) Start() error

type IOLinkEndpointOption

type IOLinkEndpointOption func(*IOLinkEndpoint)

func IOLinkEndpointWithMtu

func IOLinkEndpointWithMtu(mtu uint32) IOLinkEndpointOption

func IOLinkEndpointWithOffset

func IOLinkEndpointWithOffset(offset uint32) IOLinkEndpointOption

func IOLinkEndpointWithRejector

func IOLinkEndpointWithRejector(reject inboundcommon.Rejector) IOLinkEndpointOption

type ReadWriteCloserSplitUdp

type ReadWriteCloserSplitUdp struct {
	Rw     io.ReadWriteCloser
	Offset int32
	// contains filtered or unexported fields
}

func NewReadWriteCloserSplitUdp

func NewReadWriteCloserSplitUdp(rw io.ReadWriteCloser, offset int32) *ReadWriteCloserSplitUdp

func (*ReadWriteCloserSplitUdp) Close

func (u *ReadWriteCloserSplitUdp) Close() error

func (*ReadWriteCloserSplitUdp) Name

func (u *ReadWriteCloserSplitUdp) Name() string

func (*ReadWriteCloserSplitUdp) Read

func (u *ReadWriteCloserSplitUdp) Read(p []byte) (int, error)

func (*ReadWriteCloserSplitUdp) ReadPacket

func (u *ReadWriteCloserSplitUdp) ReadPacket() (*buf.Buffer, error)

func (*ReadWriteCloserSplitUdp) Start

func (u *ReadWriteCloserSplitUdp) Start() error

func (*ReadWriteCloserSplitUdp) Write

func (u *ReadWriteCloserSplitUdp) Write(p []byte) (int, error)

func (*ReadWriteCloserSplitUdp) WritePacket

func (u *ReadWriteCloserSplitUdp) WritePacket(p *buf.Buffer) error

type StackOption

type StackOption func(*stack.Stack) error

func AddProtocolAddress

func AddProtocolAddress(id tcpip.NICID, ips []*geo.CIDR) StackOption

func CreateNIC

func CreateNIC(id tcpip.NICID, linkEndpoint stack.LinkEndpoint) StackOption

func SetPromiscuousMode

func SetPromiscuousMode(id tcpip.NICID) StackOption

func SetRouteTable

func SetRouteTable(id tcpip.NICID) StackOption

func SetSpoofing

func SetSpoofing(id tcpip.NICID) StackOption

func SetTCPHandler

func SetTCPHandler(in *TunGvisorInbound) StackOption

func SetTCPReceiveBufferSize

func SetTCPReceiveBufferSize(defaultSize, maxSize int) StackOption

func SetTCPSendBufferSize

func SetTCPSendBufferSize(defaultSize, maxSize int) StackOption

func SetUDPHandler

func SetUDPHandler(in *TunGvisorInbound) StackOption

type TunGvisorInbound

type TunGvisorInbound struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewGvisorInbound

func NewGvisorInbound(option *GvisorInboundOption) (*TunGvisorInbound, error)

func (*TunGvisorInbound) Close

func (gi *TunGvisorInbound) Close() error

func (*TunGvisorInbound) CloseBlocking

func (gi *TunGvisorInbound) CloseBlocking() error

func (*TunGvisorInbound) Handle

func (h *TunGvisorInbound) Handle(conn tun_net.TCPConn)

func (*TunGvisorInbound) HandleUdp

func (h *TunGvisorInbound) HandleUdp(conn tun_net.UDPConn)

func (*TunGvisorInbound) HandleUdpFlow

func (h *TunGvisorInbound) HandleUdpFlow(conn tun_net.UDPConn, src, dest net.Destination)

func (*TunGvisorInbound) HandleUdpPacketConn

func (h *TunGvisorInbound) HandleUdpPacketConn(conn tun_net.UDPConn, src, dest net.Destination)

func (*TunGvisorInbound) Start

func (gi *TunGvisorInbound) Start() error

func (*TunGvisorInbound) Tag

func (gi *TunGvisorInbound) Tag() string

func (*TunGvisorInbound) WithHandler

func (gi *TunGvisorInbound) WithHandler(h i.Handler)

type TunLinkEndpoint

type TunLinkEndpoint struct {
	*channel.Endpoint
	// contains filtered or unexported fields
}

Read packets from ReadWriter, send the packets to gvisor stack; meanwhile, read packets from gvisor stack, write the packets to ReadWriter

func NewTunLinkEndpoint

func NewTunLinkEndpoint(prw tun.TunDeviceWithInfo, mtu uint32, opts ...TunLinkEndpointOption) *TunLinkEndpoint

func (*TunLinkEndpoint) Close

func (e *TunLinkEndpoint) Close()

func (*TunLinkEndpoint) Start

func (e *TunLinkEndpoint) Start() error

type TunLinkEndpointOption

type TunLinkEndpointOption func(*TunLinkEndpoint)

func TunLinkEndpointWithRejector

func TunLinkEndpointWithRejector(reject inboundcommon.Rejector) TunLinkEndpointOption

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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