net

package
v0.2.9 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2026 License: MIT Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SO_ORIGINAL_DST = 80
)

Variables

View Source
var (
	ErrNFTablesConn  = errors.New("nftables connection failed")
	ErrNFTablesApply = errors.New("nftables apply failed")
	ErrListen        = errors.New("listen failed")
	ErrSyscall       = errors.New("syscall conn failed")
	ErrOriginalDst   = errors.New("getsockopt SO_ORIGINAL_DST failed")
)

Functions

This section is empty.

Types

type CAPool

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

func NewCAPool

func NewCAPool() (*CAPool, error)

func (*CAPool) CACertPEM

func (p *CAPool) CACertPEM() []byte

func (*CAPool) GetCertificate

func (p *CAPool) GetCertificate(serverName string) (*tls.Certificate, error)

type DNSForwarder added in v0.2.9

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

DNSForwarder relays guest DNS queries to upstream resolvers.

func NewDNSForwarder added in v0.2.9

func NewDNSForwarder(bindAddr string, dnsServers []string) (*DNSForwarder, error)

NewDNSForwarder starts a UDP forwarder on bindAddr.

func (*DNSForwarder) Close added in v0.2.9

func (d *DNSForwarder) Close() error

Close stops the server and releases the socket.

func (*DNSForwarder) Port added in v0.2.9

func (d *DNSForwarder) Port() int

Port returns the ephemeral port chosen by the kernel.

type HTTPInterceptor

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

func NewHTTPInterceptor

func NewHTTPInterceptor(pol *policy.Engine, events chan api.Event, caPool *CAPool) *HTTPInterceptor

func (*HTTPInterceptor) HandleHTTP

func (i *HTTPInterceptor) HandleHTTP(guestConn net.Conn, dstIP string, dstPort int)

func (*HTTPInterceptor) HandleHTTPS

func (i *HTTPInterceptor) HandleHTTPS(guestConn net.Conn, dstIP string, dstPort int)

type NFTablesNAT

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

func NewNFTablesNAT

func NewNFTablesNAT(tapInterface string) *NFTablesNAT

func (*NFTablesNAT) Cleanup

func (n *NFTablesNAT) Cleanup() error

func (*NFTablesNAT) Setup

func (n *NFTablesNAT) Setup() error

type NFTablesRules

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

func NewNFTablesRules

func NewNFTablesRules(tapInterface, gatewayIP string, httpPort, httpsPort, passthroughPort int, dnsServers []string) *NFTablesRules

func (*NFTablesRules) Cleanup

func (r *NFTablesRules) Cleanup() error

func (*NFTablesRules) SetDNSForwarderPort added in v0.2.9

func (r *NFTablesRules) SetDNSForwarderPort(port int)

func (*NFTablesRules) Setup

func (r *NFTablesRules) Setup() error

type ProxyConfig

type ProxyConfig struct {
	BindAddr        string // Address to bind (e.g., "192.168.100.1")
	HTTPPort        int    // Port for HTTP interception (e.g., 8080)
	HTTPSPort       int    // Port for HTTPS interception (e.g., 8443)
	PassthroughPort int    // Port for policy-gated TCP passthrough (non-80/443). 0 = OS-assigned, negative = disabled
	Policy          *policy.Engine
	Events          chan api.Event
	CAPool          *CAPool
}

type TransparentProxy

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

func NewTransparentProxy

func NewTransparentProxy(cfg *ProxyConfig) (*TransparentProxy, error)

func (*TransparentProxy) BindAddr

func (tp *TransparentProxy) BindAddr() string

func (*TransparentProxy) Close

func (tp *TransparentProxy) Close() error

func (*TransparentProxy) HTTPPort

func (tp *TransparentProxy) HTTPPort() int

func (*TransparentProxy) HTTPSPort

func (tp *TransparentProxy) HTTPSPort() int

func (*TransparentProxy) PassthroughPort added in v0.1.7

func (tp *TransparentProxy) PassthroughPort() int

func (*TransparentProxy) Start

func (tp *TransparentProxy) Start()

Jump to

Keyboard shortcuts

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