netstack

package
v0.83.2 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2026 License: BSD-3-Clause Imports: 8 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	EnvUseNetstackMode = "NB_USE_NETSTACK_MODE"

	// EnvSocks5ListenerPort overrides the port the SOCKS5 proxy listens on.
	EnvSocks5ListenerPort = "NB_SOCKS5_LISTENER_PORT"

	// EnvSocks5ListenerAddress overrides the host/IP the SOCKS5 proxy binds to.
	// The proxy is a bridge for local host applications into the userspace
	// WireGuard netstack, so it binds to loopback by default. Override this only
	// when the proxy must be reachable from other hosts (e.g. a container
	// gateway); doing so exposes an unauthenticated SOCKS5 proxy on that
	// address.
	EnvSocks5ListenerAddress = "NB_SOCKS5_LISTENER_ADDRESS"
)
View Source
const (
	DefaultSocks5Port = 1080
)
View Source
const EnvSkipProxy = "NB_NETSTACK_SKIP_PROXY"

Variables

This section is empty.

Functions

func IsEnabled

func IsEnabled() bool

IsEnabled todo: move these function to cmd layer

func ListenAddr

func ListenAddr() string

Types

type Dialer

type Dialer interface {
	Dial(ctx context.Context, network, addr string) (net.Conn, error)
}

type NSDialer

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

func NewNSDialer

func NewNSDialer(net *wgbackend.NetstackNet) *NSDialer

func (*NSDialer) Dial

func (d *NSDialer) Dial(ctx context.Context, network, addr string) (net.Conn, error)

type NetStackTun

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

func NewNetStackTun

func NewNetStackTun(listenAddress string, addresses []netip.Addr, dnsAddress netip.Addr, mtu int) *NetStackTun

func (*NetStackTun) Close

func (t *NetStackTun) Close() error

func (*NetStackTun) Create

type Proxy

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

Proxy todo close server

func NewSocks5

func NewSocks5(dialer Dialer) (*Proxy, error)

func (*Proxy) Close

func (s *Proxy) Close() error

func (*Proxy) ListenAndServe

func (s *Proxy) ListenAndServe(addr string) error

Jump to

Keyboard shortcuts

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