system

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2026 License: AGPL-3.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewNat

func NewNat() *nat

Types

type ICMPEchoHandler added in v1.6.0

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

ICMPEchoHandler answers local echo and forwards others via router-selected ICMP outbounds.

func NewICMPEchoHandler added in v1.6.0

func NewICMPEchoHandler(opt ICMPEchoHandlerOption) *ICMPEchoHandler

func (*ICMPEchoHandler) ClearRoutes added in v1.6.0

func (h *ICMPEchoHandler) ClearRoutes()

ClearRoutes closes all cached ICMP outbound routes without shutting down the handler.

func (*ICMPEchoHandler) Close added in v1.6.0

func (h *ICMPEchoHandler) Close() error

func (*ICMPEchoHandler) Handle added in v1.6.0

func (h *ICMPEchoHandler) Handle(p *buf.Buffer, ipPacket gtcpip.IPPacket)

type ICMPEchoHandlerOption added in v1.6.0

type ICMPEchoHandlerOption struct {
	Tun      packetWriter
	Router   i.Router
	Tag      string
	Listen4  net.IP
	Listen6  net.IP
	Ctx      context.Context
	IsClosed func() bool
}

type ICMPHandler added in v1.6.0

type ICMPHandler interface {
	Handle(p *buf.Buffer, ipPacket gtcpip.IPPacket)
	// ClearRoutes drops cached outbound ICMP sockets so the next echo re-picks a handler.
	ClearRoutes()
	Close() error
}

ICMPHandler handles ICMP IP packets demuxed by TunSystemInbound. Handle takes ownership of p.

type Option

type Option func(*TunSystemInbound)

func With4

func With4(natIP net.IP, listenIP net.IP, listenPort uint16) Option

func With6

func With6(natIP net.IP, listenIP net.IP, listenPort uint16) Option

func WithDns

func WithDns(dnsDispatcher dns.DnsConn, dnsAddress []mynet.Destination) Option

func WithHandler

func WithHandler(h i.Handler) Option

func WithICMPHandler added in v1.6.0

func WithICMPHandler(h ICMPHandler) Option

func WithRejector

func WithRejector(rejector inboundcommon.Rejector) Option

func WithTag

func WithTag(tag string) Option

func WithTun

func WithTun(tun tunDevice) Option

type SrcDst

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

type TunSystemInbound

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

func New

func New(opts ...Option) *TunSystemInbound

func (*TunSystemInbound) ClearICMPRoutes added in v1.6.0

func (t *TunSystemInbound) ClearICMPRoutes()

ClearICMPRoutes drops cached ICMP outbound routes (e.g. after routing mode changes).

func (*TunSystemInbound) Close

func (t *TunSystemInbound) Close() error

func (*TunSystemInbound) Closed added in v1.6.0

func (t *TunSystemInbound) Closed() bool

func (*TunSystemInbound) Context added in v1.6.0

func (t *TunSystemInbound) Context() context.Context

func (*TunSystemInbound) Start

func (ti *TunSystemInbound) Start() error

func (*TunSystemInbound) Tag

func (t *TunSystemInbound) Tag() string

func (*TunSystemInbound) WritePacket

func (t *TunSystemInbound) WritePacket(p *udp.Packet) error

Jump to

Keyboard shortcuts

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