forwarder

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2025 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrCouldNotFindInternalHostVeth         = errors.New("could not find internal host veth")
	ErrCouldNotCreatingIPTables             = errors.New("could not create iptables")
	ErrCouldNotSplitHostPort                = errors.New("could not split host and port")
	ErrCouldNotResolveIPAddr                = errors.New("could not resolve IP address")
	ErrCouldNotWriteFileRouteLocalnetAll    = errors.New("could not write to /proc/sys/net/ipv4/conf/all/route_localnet")
	ErrCouldNotWriteFileRouteLocalnetLo     = errors.New("could not write to /proc/sys/net/ipv4/conf/lo/route_localnet")
	ErrCouldNotGetOriginalNSHandle          = errors.New("could not get original namespace handle")
	ErrCouldNotSetOriginalNSHandle          = errors.New("could not set original namespace handle")
	ErrCouldNotGetNSHandle                  = errors.New("could not get namespace handle")
	ErrCouldNotSetNSHandle                  = errors.New("could not set namespace handle")
	ErrCouldNotListInterfaces               = errors.New("could not list interfaces")
	ErrCouldNotGetInterfaceAddresses        = errors.New("could not get interface addresses")
	ErrCouldNotAppendIPTablesFilterForwardD = errors.New("could not append iptables filter FORWARD -d rule")
	ErrCouldNotDeleteIPTablesFilterForwardD = errors.New("could not delete iptables filter FORWARD -d rule")
	ErrCouldNotAppendIPTablesFilterForwardS = errors.New("could not append iptables filter FORWARD -s rule")
	ErrCouldNotDeleteIPTablesFilterForwardS = errors.New("could not delete iptables filter FORWARD -s rule")
	ErrCouldNotAppendIPTablesNatOutput      = errors.New("could not append iptables nat OUTPUT rule")
	ErrCouldNotDeleteIPTablesNatOutput      = errors.New("could not delete iptables nat OUTPUT rule")
	ErrCouldNotAppendIPTablesNatPrerouting  = errors.New("could not append iptables nat PREROUTING rule")
	ErrCouldNotDeleteIPTablesNatPrerouting  = errors.New("could not delete iptables nat PREROUTING rule")
	ErrCouldNotAppendIPTablesNatPostrouting = errors.New("could not append iptables nat POSTROUTING rule")
	ErrCouldNotDeleteIPTablesNatPostrouting = errors.New("could not delete iptables nat POSTROUTING rule")
)

Functions

This section is empty.

Types

type ForwardedPorts

type ForwardedPorts struct {
	Wait  func() error
	Close func() error
}

func ForwardPorts

func ForwardPorts(
	ctx context.Context,

	hostVethCIDR *net.IPNet,

	ports []PortForward,

	hooks PortForwardHooks,
) (forwardedPorts *ForwardedPorts, errs error)

type PortForward

type PortForward struct {
	Netns        string `json:"netns"`
	InternalPort string `json:"internalPort"`
	Protocol     string `json:"protocol"`

	ExternalAddr string `json:"externalAddr"`
}

type PortForwardHooks

type PortForwardHooks struct {
	OnAfterPortForward func(
		portID int,

		netns string,

		internalIP string,
		internalPort string,

		externalIP string,
		externalPort string,

		protocol string,
	)
	OnBeforePortUnforward func(portID int)
}

Jump to

Keyboard shortcuts

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