Documentation ¶
Overview ¶
Package netutil contains misc shared networking code & types.
Package netutil contains misc shared networking code & types.
Index ¶
- 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 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 can be nil, in which case interfaces.GetState is used. 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.