package netx
import "tailscale.com/net/netx"
Package netx contains types to describe and abstract over how dialing and listening are performed.
Index ¶
Types ¶
type DialFunc ¶
DialFunc is a function that dials a network address.
It's the type implemented by net.Dialer.DialContext or required by net/http.Transport.DialContext, etc.
type Network ¶
type Network interface { NewLocalTCPListener() net.Listener Listen(network, address string) (net.Listener, error) Dial(ctx context.Context, network, address string) (net.Conn, error) }
Network describes a network that can listen and dial. The two common implementations are RealNetwork, using the net package to use the real network, or [memnet.Network], using an in-memory network (typically for testing)
func RealNetwork ¶
func RealNetwork() Network
RealNetwork returns a Network implementation that uses the real net package.
Source Files ¶
netx.go
- Version
- v1.84.0 (latest)
- Published
- May 21, 2025
- Platform
- linux/amd64
- Imports
- 3 packages
- Last checked
- 1 day ago –
Tools for package owners.