Documentation ¶
Overview ¶
Package netutil contains misc shared networking code & types.
Package netutil contains misc shared networking code & types.
Index ¶
- func CalcAdvertiseRoutes(advertiseRoutes string, advertiseDefaultRoute bool) ([]netip.Prefix, error)
- func CheckIPForwarding(routes []netip.Prefix, state *interfaces.State) (warn, err error)
- func NewAltReadWriteCloserConn(rwc io.ReadWriteCloser, c net.Conn) net.Conn
- func NewDrainBufConn(c net.Conn, initialReadBuf *bufio.Reader) net.Conn
- func NewOneConnListener(c net.Conn, addr net.Addr) net.Listener
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CalcAdvertiseRoutes ¶ added in v1.48.0
func CalcAdvertiseRoutes(advertiseRoutes string, advertiseDefaultRoute bool) ([]netip.Prefix, error)
CalcAdvertiseRoutes calculates the requested routes to be advertised by a node. advertiseRoutes is the user-provided, comma-separated list of routes (IP addresses or CIDR prefixes) to advertise. advertiseDefaultRoute indicates whether the node should act as an exit node and advertise default routes.
func CheckIPForwarding ¶ added in v1.24.0
func CheckIPForwarding(routes []netip.Prefix, state *interfaces.State) (warn, err error)
CheckIPForwarding reports whether IP forwarding is enabled correctly for subnet routing and exit node functionality on any interface. The state param must not be nil. The routes should only be advertised routes, and should not contain the nodes Tailscale IPs. It returns an error if it is unable to determine if IP forwarding is enabled. It returns a warning describing configuration issues if IP forwarding is non-functional or partly functional.
func NewAltReadWriteCloserConn ¶ added in v1.24.0
NewAltReadWriteCloserConn returns a net.Conn that wraps rwc (for Read, Write, and Close) and c (for all other methods).
func NewDrainBufConn ¶ added in v1.24.0
NewDrainBufConn returns a net.Conn conditionally wrapping c, prefixing any bytes that are in initialReadBuf, which may be nil.
func NewOneConnListener ¶
NewOneConnListener returns a net.Listener that returns c on its first Accept and EOF thereafter.
The returned Listener's Addr method returns addr if non-nil. If nil, Addr returns a non-nil dummy address instead.
Types ¶
This section is empty.