net

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2024 License: Apache-2.0 Imports: 4 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsPrivateAddress added in v1.0.4

func IsPrivateAddress(ip net.IP) bool

IsPrivateAddress returns whether an IP address belongs to the LAN.

func Relay

func Relay(leftConn, rightConn DuplexConn) (int64, int64, error)

Relay copies between left and right bidirectionally. Returns number of bytes copied from right to left, from left to right, and any error occurred. Relay allows for half-closed connections: if one side is done writing, it can still read all remaining data from its peer.

func RequirePublicIP added in v1.1.1

func RequirePublicIP(ip net.IP) error

RequirePublicIP returns an error if the destination IP is not a standard public IP.

Types

type ConnectionError

type ConnectionError struct {
	// TODO: create status enums and move to metrics.go
	Status  string
	Message string
	Cause   error
}

func NewConnectionError

func NewConnectionError(status, message string, cause error) *ConnectionError

func (*ConnectionError) Error added in v1.5.0

func (e *ConnectionError) Error() string

func (*ConnectionError) Unwrap added in v1.5.0

func (e *ConnectionError) Unwrap() error

type DuplexConn

type DuplexConn = transport.StreamConn

type TargetIPValidator added in v1.3.0

type TargetIPValidator = func(net.IP) error

TargetIPValidator is a type alias for checking if an IP is allowed.

Jump to

Keyboard shortcuts

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