netutil

package
v0.0.0-...-3caaee0 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2022 License: BSD-3-Clause Imports: 14 Imported by: 0

Documentation

Overview

Package netutil contains misc shared networking code & types.

Package netutil contains misc shared networking code & types.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckIPForwarding

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

func NewAltReadWriteCloserConn(rwc io.ReadWriteCloser, c net.Conn) net.Conn

NewAltReadWriteCloserConn returns a net.Conn that wraps rwc (for Read, Write, and Close) and c (for all other methods).

func NewDrainBufConn

func NewDrainBufConn(c net.Conn, initialReadBuf *bufio.Reader) net.Conn

NewDrainBufConn returns a net.Conn conditionally wrapping c, prefixing any bytes that are in initialReadBuf, which may be nil.

func NewOneConnListener

func NewOneConnListener(c net.Conn, addr net.Addr) net.Listener

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.

Jump to

Keyboard shortcuts

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