gonnect

package module
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: May 3, 2026 License: CC0-1.0 Imports: 11 Imported by: 0

README

Go Reference

Gonnect

Gonnect is a collection of network helper functions and common types that have been reinvented and reimplemented countless times in many Go projects. I created it mostly for myself, but feel free to use it in your projects or suggest features.

There are some projects based on Gonnect or created for similar use cases. You may find them useful too:

  • gonnect-netstack - gVisor's netstack integration for the gonnect ecosystem
  • gonnect-vpn-example - An example of simple point-to-point VPN built on top of the gonnect ecosystem
  • tuntap - Cross-platform TUN device library extracted from wireguard-go
  • batchudp - UDP transport package extracted from wireguard-go/conn
  • wgo - WireGuard library based on gonnect-netstack, tuntap, batchudp with amnesia obfuscation support
  • wg-web-demo - browser WASM demonstration of HTTP over WireGuard over socks-over-websocket using userspace TCP/IP stack
  • socksgo – The most complete, compatible, feature-rich, and extensible SOCKS library for Go
  • bufpool – Byte buffer pool interface and testing helpers
  • putback – A minimal library that provides wrappers for common I/O interfaces, adding the ability to return read bytes back to the stream for subsequent reading
  • mnlib - Mesh-oriented DNS names lib (.meshname, .meship, .ygg, .pk.ygg)

License

Files in this repository are distributed under the CC0 license.

CC0
To the extent possible under law, ASCIIMoth has waived all copyright and related or neighboring rights to gonnect.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConnWithCallbacks

func ConnWithCallbacks(c net.Conn, cb *Callbacks) net.Conn

ConnWithCallbacks wraps a net.Conn with callbacks, using the most specific wrapper type based on the underlying connection type.

func FalseFilter

func FalseFilter(_, _ string) bool

FalseFilter is a Filter that always returns false.

func GetWrapped

func GetWrapped(obj any) any

GetWrapped extracts the wrapped value from an object. If obj is nil or does not implement Wrapper, returns nil.

func ListenerWithCallbacks

func ListenerWithCallbacks(l net.Listener, cb *Callbacks) net.Listener

ListenerWithCallbacks wraps a net.Listener with callbacks, using the most specific wrapper type based on the underlying listener type.

func LookupPortOffline

func LookupPortOffline(network, service string) (port int, err error)

LookupPortOffline resolve port name to port (e.g. http to 80) using only local data.

func LoopbackFilter

func LoopbackFilter(_, address string) bool

LoopbackFilter returns true for localhost and loopback addresses.

func NetPacketConnWithCallbacks

func NetPacketConnWithCallbacks(
	c net.PacketConn,
	cb *Callbacks,
) net.PacketConn

NetPacketConnWithCallbacks wraps a net.PacketConn with callbacks, using the most specific wrapper type based on the underlying connection type.

func TrueFilter

func TrueFilter(_, _ string) bool

TrueFilter is a Filter that always returns true.

func UnfuckGoDns

func UnfuckGoDns()

UnfuckGoDns sets GODEBUG=netedns0=0 to disable EDNS0 extension unsupported by a lot of consumer routers but still used by go resolver by default for some fucking reason. And there is no ways to disable it with Resolver methods/fields or something.

Some related links:

It is safe to use UnfuckGoDns with already set GODEBUG var. UnfuckGoDns only appends netedns0=0 if netedns0 is not set. It doesn't alter other fields and do nothing if netedns0 is already set.

Types

type CallbackConn

type CallbackConn struct {
	net.Conn
	CB *Callbacks
}

CallbackConn wraps a net.Conn and invokes callbacks on events.

func (*CallbackConn) Close

func (c *CallbackConn) Close() error

Close calls the BeforeClose callback, then closes the underlying connection.

func (*CallbackConn) GetWrapped

func (c *CallbackConn) GetWrapped() any

GetWrapped returns the underlying wrapped connection.

type CallbackListener

type CallbackListener struct {
	net.Listener
	CB *Callbacks
}

CallbackListener wraps a net.Listener and invokes callbacks on events.

func (*CallbackListener) Accept

func (c *CallbackListener) Accept() (net.Conn, error)

Accept accepts a connection and invokes OnAccept if the callback is set.

func (*CallbackListener) Close

func (c *CallbackListener) Close() error

Close calls the BeforeClose callback, then closes the underlying listener.

func (*CallbackListener) GetWrapped

func (c *CallbackListener) GetWrapped() any

GetWrapped returns the underlying wrapped listener.

type CallbackNetPacketConn

type CallbackNetPacketConn struct {
	net.PacketConn
	CB *Callbacks
}

CallbackNetPacketConn wraps a net.PacketConn and invokes callbacks on events.

func (*CallbackNetPacketConn) Close

func (c *CallbackNetPacketConn) Close() error

Close calls the BeforeClose callback, then closes the underlying connection.

func (*CallbackNetPacketConn) GetWrapped

func (c *CallbackNetPacketConn) GetWrapped() any

GetWrapped returns the underlying wrapped connection.

type CallbackPacketConn

type CallbackPacketConn struct {
	PacketConn
	CB *Callbacks
}

CallbackPacketConn wraps a PacketConn and invokes callbacks on events.

func (*CallbackPacketConn) Close

func (c *CallbackPacketConn) Close() error

Close calls the BeforeClose callback, then closes the underlying connection.

func (*CallbackPacketConn) GetWrapped

func (c *CallbackPacketConn) GetWrapped() any

GetWrapped returns the underlying wrapped connection.

type CallbackTCPConn

type CallbackTCPConn struct {
	TCPConn
	CB *Callbacks
}

CallbackTCPConn wraps a net.TCPConn and invokes callbacks on events.

func (*CallbackTCPConn) Close

func (c *CallbackTCPConn) Close() error

Close calls the BeforeClose callback, then closes the underlying connection.

func (*CallbackTCPConn) GetWrapped

func (c *CallbackTCPConn) GetWrapped() any

GetWrapped returns the underlying wrapped connection.

type CallbackTCPListener

type CallbackTCPListener struct {
	TCPListener
	CB *Callbacks
}

CallbackTCPListener wraps a net.TCPListener and invokes callbacks on events.

func (*CallbackTCPListener) Accept

func (c *CallbackTCPListener) Accept() (net.Conn, error)

Accept accepts a connection and invokes OnAccept if the callback is set.

func (*CallbackTCPListener) AcceptTCP

func (c *CallbackTCPListener) AcceptTCP() (TCPConn, error)

AcceptTCP accepts a TCP connection and invokes OnAcceptTCP if the callback is set.

func (*CallbackTCPListener) Close

func (c *CallbackTCPListener) Close() error

Close calls the BeforeClose callback, then closes the underlying listener.

func (*CallbackTCPListener) GetWrapped

func (c *CallbackTCPListener) GetWrapped() any

GetWrapped returns the underlying wrapped listener.

type CallbackUDPConn

type CallbackUDPConn struct {
	UDPConn
	CB *Callbacks
}

CallbackUDPConn wraps a net.UDPConn and invokes callbacks on events.

func (*CallbackUDPConn) Close

func (c *CallbackUDPConn) Close() error

Close calls the BeforeClose callback, then closes the underlying connection.

func (*CallbackUDPConn) GetWrapped

func (c *CallbackUDPConn) GetWrapped() any

GetWrapped returns the underlying wrapped connection.

type Callbacks

type Callbacks struct {
	// BeforeClose is called before the connection or listener is closed.
	BeforeClose func()
	// OnAccept is called when a listener accepts a new connection.
	// The callback can return a different connection or an error to reject it.
	OnAccept func(net.Conn) (net.Conn, error)
	// OnAcceptTCP is called when a TCP listener accepts a new TCP connection.
	// The callback can return a different TCP connection or an error to reject it.
	OnAcceptTCP func(TCPConn) (TCPConn, error)
}

Callbacks holds callback functions invoked on various network events.

func (*Callbacks) RunBeforeClose

func (c *Callbacks) RunBeforeClose()

func (*Callbacks) RunOnAccept

func (c *Callbacks) RunOnAccept(conn net.Conn) (net.Conn, error)

func (*Callbacks) RunOnAcceptTCP

func (c *Callbacks) RunOnAcceptTCP(conn TCPConn) (TCPConn, error)

type CustomFilter

type CustomFilter struct {
	Hosts []HostFilterEntry
	IPs   []IpFilterEntry
	CIDRs []*net.IPNet
}

CustomFilter is a Filter that matches addresses based on a set of patterns. Patterns are similar to the NO_PROXY environment variable format.

func FilterFromString

func FilterFromString(str string) CustomFilter

FilterFromString creates a CustomFilter from a comma-separated string.

Each entry can be:

  • host:port - matches this host and port combination
  • host - matches this host on any port
  • ip - matches this exact IP address
  • ip/subnet - matches any IP in this CIDR subnet
  • Wildcards (*, ?) are supported in host patterns using shell glob matching

Examples:

  • "localhost,127.0.0.1" - true for localhost and IPv4 loopback
  • "*.example.com" - true for all subdomains of example.com
  • "192.168.0.0/16" - true for entire 192.168.x.x subnet
  • "internal.corp:8080" - true for specific host:port

The filter is case-insensitive and handles both bracketed IPv6 addresses (e.g., [::1]:8080) and trailing dots in hostnames.

func (CustomFilter) Filter

func (f CustomFilter) Filter(network, address string) bool

Filter implements the Filter function for CustomFilter.

type Dial

type Dial = func(ctx context.Context, network, address string) (net.Conn, error)

Dial is a function type for establishing TCP-like connections. It matches the signature of net.Dialer.DialContext.

type DialTCP

type DialTCP = func(
	ctx context.Context,
	network, laddr, raddr string,
) (TCPConn, error)

DialTCP establishes a TCP connection similar to net.Dial for TCP networks.

type DialUDP

type DialUDP = func(
	ctx context.Context,
	network, laddr, raddr string,
) (UDPConn, error)

DialUDP creates a UDP connection similar to net.Dial for UDP networks.

type DnsServer

type DnsServer struct {
	// Net is the network type to use (e.g., "udp", "tcp").
	// If empty, defaults to "udp".
	Net string
	// Addr is the address of the DNS server (e.g., "8.8.8.8:53" or "1.1.1.1").
	// By default port is 53 so it can be omitted.
	Addr string
}

DnsServer specifies a custom DNS server to use for resolution.

type Filter

type Filter = func(network, address string) bool

Filter functions are used whenever different handling should be applied to connections/requests depending on their network and address. For example, a proxy can use a filter to decide whether a connection should be passed directly (true) or proxied (false), or to block/allow, etc.

Network may be "" if unknown.

func InvertFilter

func InvertFilter(filter Filter) Filter

InvertFilter is a Filter that returns iverted result of filter.

func OrFilter

func OrFilter(filters ...Filter) Filter

OrFilter is a Filter that returns true if any of filters do it.

type HostFilterEntry

type HostFilterEntry struct {
	Pattern  string // wildcard pattern, lowercased, no trailing dot
	WithPort bool
	Port     string
}

type InterfaceNetwork

type InterfaceNetwork interface {
	// Interfaces returns the list of network interfaces known to this Network.
	// Implementations may return an empty slice when the network is virtual,
	// even though Dial/Listen/ListenPacket may still be usable. Multiple
	// entries with the same Index or Name are allowed.
	Interfaces() ([]NetworkInterface, error)
	// InterfaceAddrs returns the addresses associated with interfaces known
	// to this Network.
	// Implementations may return an empty slice when the network is virtual,
	// even though Dial/Listen/ListenPacket may still be usable.
	// Duplicates are allowed.
	InterfaceAddrs() ([]net.Addr, error)
	// InterfacesByIndex returns all interfaces that match the provided index.
	// Implementations may return an empty slice when the network is virtual,
	// even though Dial/Listen/ListenPacket may still be usable.
	// Multiple interfaces with the same index are allowed.
	InterfacesByIndex(index int) ([]NetworkInterface, error)
	// InterfacesByName returns all interfaces that match the provided name.
	// Implementations may return an empty slice when the network is virtual,
	// even though Dial/Listen/ListenPacket may still be usable.
	// Multiple interfaces with the same name are allowed.
	InterfacesByName(name string) ([]NetworkInterface, error)
}

Network defines an abstraction over network providers with multiple interfaces support.

type IpFilterEntry

type IpFilterEntry struct {
	IP       net.IP
	WithPort bool
	Port     string
}

type Listen

type Listen = func(ctx context.Context, network, address string) (net.Listener, error)

Listen is a function type for creating TCP-like listeners.

type ListenConfig added in v0.8.0

type ListenConfig struct {
	Control func(network, address string, c syscall.RawConn) error
}

type ListenConfigNetwork added in v0.8.0

type ListenConfigNetwork interface {
	ListenPacketConfig(
		ctx context.Context,
		lc *ListenConfig,
		network, address string,
	) (PacketConn, error)

	ListenUDPConfig(
		ctx context.Context,
		lc *ListenConfig,
		network, laddr string,
	) (UDPConn, error)
}

type ListenTCP

type ListenTCP = func(
	ctx context.Context,
	network, laddr string,
) (TCPListener, error)

ListenTCP announces and returns a listener for TCP connections.

type ListenUDP

type ListenUDP = func(
	ctx context.Context,
	network, laddr string,
) (UDPConn, error)

ListenUDP announces and returns a packet-oriented UDP connection.

type LiteralInterface

type LiteralInterface struct {
	IDVal             string
	IndexVal          int
	NameVal           string
	MTUVal            int
	HardwareAddrVal   net.HardwareAddr
	FlagsVal          net.Flags
	AddrsVal          []net.Addr
	MulticastAddrsVal []net.Addr
}

func (*LiteralInterface) Addrs

func (i *LiteralInterface) Addrs() ([]net.Addr, error)

func (*LiteralInterface) Flags

func (i *LiteralInterface) Flags() net.Flags

func (*LiteralInterface) HardwareAddr

func (i *LiteralInterface) HardwareAddr() net.HardwareAddr

func (*LiteralInterface) ID

func (i *LiteralInterface) ID() string

func (*LiteralInterface) Index

func (i *LiteralInterface) Index() int

func (*LiteralInterface) MTU

func (i *LiteralInterface) MTU() int

func (*LiteralInterface) MulticastAddrs

func (i *LiteralInterface) MulticastAddrs() ([]net.Addr, error)

func (*LiteralInterface) Name

func (i *LiteralInterface) Name() string

type LookupAddr

type LookupAddr = func(ctx context.Context, addr string) (names []string, err error)

LookupAddr performs a reverse lookup for the given address, returning a list of names mapping to that address.

type LookupCNAME

type LookupCNAME = func(ctx context.Context, host string) (cname string, err error)

LookupCNAME returns the canonical name for the given host.

type LookupHost

type LookupHost = func(ctx context.Context, host string) (addrs []string, err error)

LookupHost looks up host just like LookupIP but unlike it returns slice of IP strings.

type LookupIP

type LookupIP = func(ctx context.Context, network, address string) ([]net.IP, error)

LookupIP looks up host. It returns a slice of that host's IPv4 and IPv6 addresses.

type LookupIPAddr

type LookupIPAddr = func(ctx context.Context, host string) ([]net.IPAddr, error)

LookupIPAddr looks up host just like LookupIP but unlike it returns slice of net.IPAddr.

type LookupMX

type LookupMX = func(ctx context.Context, name string) ([]*net.MX, error)

LookupMX returns the DNS MX records for the given domain name sorted by preference.

type LookupNS

type LookupNS = func(ctx context.Context, name string) ([]*net.NS, error)

LookupNS returns the DNS NS records for the given domain name.

type LookupNetIP

type LookupNetIP = func(ctx context.Context, network, host string) ([]netip.Addr, error)

LookupNetIP looks up host just like LookupIP but unlike it returns slice of netip.Addr.

type LookupPort

type LookupPort = func(ctx context.Context, network, service string) (port int, err error)

LookupPort looks up the port for the given network and service.

type LookupSRV

type LookupSRV = func(ctx context.Context, service, proto, name string) (string, []*net.SRV, error)

LookupSRV tries to resolve an SRV query of the given service, protocol, and domain name. The proto is "tcp" or "udp".

type LookupTXT

type LookupTXT = func(ctx context.Context, name string) ([]string, error)

LookupTXT returns the DNS TXT records for the given domain name. If a DNS TXT record holds multiple strings, they are concatenated as a single string.

type NativeInterface

type NativeInterface struct {
	Iface net.Interface
}

func (*NativeInterface) Addrs

func (i *NativeInterface) Addrs() ([]net.Addr, error)

func (*NativeInterface) Flags

func (i *NativeInterface) Flags() net.Flags

func (*NativeInterface) HardwareAddr

func (i *NativeInterface) HardwareAddr() net.HardwareAddr

func (*NativeInterface) ID

func (i *NativeInterface) ID() string

func (*NativeInterface) Index

func (i *NativeInterface) Index() int

func (*NativeInterface) MTU

func (i *NativeInterface) MTU() int

func (*NativeInterface) MulticastAddrs

func (i *NativeInterface) MulticastAddrs() ([]net.Addr, error)

func (*NativeInterface) Name

func (i *NativeInterface) Name() string

type NetTCPListener

type NetTCPListener struct {
	*net.TCPListener
}

func (*NetTCPListener) AcceptTCP

func (l *NetTCPListener) AcceptTCP() (TCPConn, error)

type Network

type Network interface {
	// IsNative reports whether Network instance provides direct access to
	// OS network stack or emulates it/adding mutation wrappers.
	// Simple Network middlewares like logging ones should preserve IsNative status
	// while complex ones (e.g. encrypting/proxyng/etc) should reports false.
	IsNative() bool

	Dial(
		ctx context.Context,
		network, address string,
	) (net.Conn, error)

	Listen(
		ctx context.Context,
		network, address string,
	) (net.Listener, error)

	PacketDial(ctx context.Context, network, address string) (PacketConn, error)

	ListenPacket(
		ctx context.Context,
		network, address string,
	) (PacketConn, error)

	DialTCP(
		ctx context.Context,
		network, laddr, raddr string,
	) (TCPConn, error)

	ListenTCP(
		ctx context.Context,
		network, laddr string,
	) (TCPListener, error)

	DialUDP(
		ctx context.Context,
		network, laddr, raddr string,
	) (UDPConn, error)

	ListenUDP(
		ctx context.Context,
		network, laddr string,
	) (UDPConn, error)
}

Network defines an abstraction over network providers.

type NetworkInterface

type NetworkInterface interface {
	ID() string
	Index() int
	Name() string
	MTU() int
	HardwareAddr() net.HardwareAddr
	Flags() net.Flags
	Addrs() ([]net.Addr, error)
	MulticastAddrs() ([]net.Addr, error)
}

func WrapNativeInterfaces

func WrapNativeInterfaces(in []net.Interface) []NetworkInterface

type PacketConn

type PacketConn interface {
	net.PacketConn
	net.Conn
}

PacketConn is an interface for UDP-like packet connections.

func PacketConnWithCallbacks

func PacketConnWithCallbacks(c PacketConn, cb *Callbacks) PacketConn

PacketConnWithCallbacks wraps a PacketConn with callbacks, using the most specific wrapper type based on the underlying connection type.

type PacketDial

type PacketDial = func(ctx context.Context, network, address string) (PacketConn, error)

PacketDial is a function type for establishing UDP-like packet connections.

type PacketListen

type PacketListen = func(ctx context.Context, network, address string) (PacketConn, error)

PacketListen is a function type for creating UDP-like packet listeners.

type Resolver

type Resolver interface {
	LookupIP(ctx context.Context, network, address string) ([]net.IP, error)

	LookupIPAddr(ctx context.Context, host string) ([]net.IPAddr, error)

	LookupNetIP(ctx context.Context, network, host string) ([]netip.Addr, error)

	LookupHost(ctx context.Context, host string) (addrs []string, err error)

	LookupAddr(ctx context.Context, addr string) (names []string, err error)

	LookupCNAME(ctx context.Context, host string) (cname string, err error)

	LookupPort(
		ctx context.Context,
		network, service string,
	) (port int, err error)

	LookupNS(ctx context.Context, name string) ([]*net.NS, error)

	LookupMX(
		ctx context.Context,
		name string,
	) ([]*net.MX, error)

	LookupSRV(
		ctx context.Context,
		service, proto, name string,
	) (string, []*net.SRV, error)

	LookupTXT(
		ctx context.Context,
		name string,
	) ([]string, error)
}

type ResolverCfg

type ResolverCfg struct {
	// DontPreferGo disables the use of Go's pure Go DNS resolver.
	// When false (default), PreferGo is enabled in the built resolver.
	DontPreferGo bool
	// StrictErrors controls whether errors from the DNS server are fatal.
	// When true, errors stop resolution immediately.
	StrictErrors bool
	// Dial is an optional custom dial function for establishing connections.
	// If nil, uses net.Dialer.DialContext.
	Dial Dial
	// Server is an optional custom DNS server to use for resolution.
	// If nil, uses the system default DNS servers.
	Server *DnsServer
}

ResolverCfg configures a DNS resolver.

func (ResolverCfg) Build

func (cfg ResolverCfg) Build() net.Resolver

Build creates and returns a configured net.Resolver instance. If Server is set, all DNS queries are routed through that server. If Dial is set, it is used for establishing connections instead of the default dialer.

type TCPConn

type TCPConn interface {
	// Read(b []byte) (n int, err error)
	// Write(b []byte) (n int, err error)
	// Close() error
	// LocalAddr() Addr
	// RemoteAddr() Addr
	// SetDeadline(t time.Time) error
	// SetReadDeadline(t time.Time) error
	// SetWriteDeadline(t time.Time) error
	net.Conn

	// ReadFrom(r io.Reader) (int64, error)
	io.ReaderFrom

	// WriteTo(w io.Writer) (int64, error)
	io.WriterTo

	SetKeepAlive(keepalive bool) error
	SetKeepAliveConfig(config net.KeepAliveConfig) error
	SetKeepAlivePeriod(d time.Duration) error
	SetLinger(sec int) error
	SetNoDelay(noDelay bool) error

	CloseRead() error
	CloseWrite() error
}

type TCPListener

type TCPListener interface {
	// Accept() (Conn, error)
	// Close() error
	// Addr() Addr
	net.Listener

	AcceptTCP() (TCPConn, error)
	SetDeadline(t time.Time) error
}

type UDPConn

type UDPConn interface {
	// Read(b []byte) (n int, err error)
	// Write(b []byte) (n int, err error)
	// Close() error
	// LocalAddr() Addr
	// RemoteAddr() Addr
	// SetDeadline(t time.Time) error
	// SetReadDeadline(t time.Time) error
	// SetWriteDeadline(t time.Time) error
	net.Conn

	// ReadFrom(p []byte) (n int, addr Addr, err error)
	// WriteTo(p []byte, addr Addr) (n int, err error)
	net.PacketConn

	ReadFromUDP(b []byte) (n int, addr *net.UDPAddr, err error)
	ReadFromUDPAddrPort(b []byte) (n int, addr netip.AddrPort, err error)

	WriteToUDP(b []byte, addr *net.UDPAddr) (int, error)
	WriteToUDPAddrPort(b []byte, addr netip.AddrPort) (int, error)

	ReadMsgUDP(b, oob []byte) (n, oobn, flags int, addr *net.UDPAddr, err error)
	ReadMsgUDPAddrPort(
		b, oob []byte,
	) (n, oobn, flags int, addr netip.AddrPort, err error)

	WriteMsgUDP(b, oob []byte, addr *net.UDPAddr) (n, oobn int, err error)
	WriteMsgUDPAddrPort(
		b, oob []byte,
		addr netip.AddrPort,
	) (n, oobn int, err error)
}

func UDPConnWithCallbacks

func UDPConnWithCallbacks(c UDPConn, cb *Callbacks) UDPConn

UDPConnWithCallbacks wraps a UDPConn with callbacks, using the most specific wrapper type based on the underlying connection type.

type UpDown

type UpDown interface {
	// Up activates or brings the resource online.
	Up() error
	// Down deactivates or brings the resource offline.
	// All active connections/listeners/etc must be closed on down.
	Down() error

	IsUp() (bool, error)
}

UpDown defines an interface for managing the operational state of a resource.

type Wrapper

type Wrapper interface {
	GetWrapped() any
}

Wrapper is an interface for types that wrap underlying values. Implementing types should return the wrapped value via GetWrapped.

Directories

Path Synopsis
Package defnet provides a default network implementation that uses native networking on platforms that support it, and falls back to a loopback (in-memory) network on platforms like wasm.
Package defnet provides a default network implementation that uses native networking on platforms that support it, and falls back to a loopback (in-memory) network on platforms like wasm.
Package errors provides canonical generators for frequently used network errors.
Package errors provides canonical generators for frequently used network errors.
Package helpers provides utility functions for network operations.
Package helpers provides utility functions for network operations.
Package loopback provides an in-memory loopback network implementation that simulates network operations without using actual network sockets.
Package loopback provides an in-memory loopback network implementation that simulates network operations without using actual network sockets.
Package native provides a native implementation of the gonnect network interfaces based Go's standard net package.
Package native provides a native implementation of the gonnect network interfaces based Go's standard net package.
Package reject provides a network implementation that rejects all operations with canonical errors.
Package reject provides a network implementation that rejects all operations with canonical errors.
Package sockopt provides platform-specific socket option manipulation.
Package sockopt provides platform-specific socket option manipulation.
Package subnet provides utilities for working with IP subnets, including well-known CIDR ranges, IP address arithmetic, and network manipulation.
Package subnet provides utilities for working with IP subnets, including well-known CIDR ranges, IP address arithmetic, and network manipulation.
Package testing implements helpers for gonnect interfaces implementations testing
Package testing implements helpers for gonnect interfaces implementations testing
Package tun provides a TUN (network tunnel) interface for handling virtual network devices.
Package tun provides a TUN (network tunnel) interface for handling virtual network devices.

Jump to

Keyboard shortcuts

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