network

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2023 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrMultipleRoutesFound = errors.New("found multiple routes in the network")
	ErrNoRoutersFound      = errors.New("no routers offering upnp services found")
)

Functions

This section is empty.

Types

type PortMapper

type PortMapper interface {
	Connect(timeout time.Duration) error
	Close()

	ExternalIP() string
	LocalIP() string

	AddPersistantPortMappingToSelf(
		description string,
		protocol Protocol,
		externalPort uint16,
		forwardToPort uint16,
	) error
	AddPersistantPortMapping(
		description string,
		protocol Protocol,
		externalPort uint16,
		forwardToPort uint16,
		forwardToAddr netip.Addr,
	) error
	AddPortMappingToSelf(
		description string,
		protocol Protocol,
		externalPort uint16,
		forwardToPort uint16,
		timeout time.Duration,
	) error
	AddPortMapping(
		description string,
		protocol Protocol,
		externalPort uint16,
		forwardToPort uint16,
		forwardToAddr netip.Addr,
		timeout time.Duration,
	) error
}

func NewPortMapper

func NewPortMapper(
	ctx context.Context,
	pRefresh time.Duration,
) PortMapper

type Protocol

type Protocol string
const (
	ProtocolTCP Protocol = "TCP"
	ProtocolUDP Protocol = "UDP"
)

Jump to

Keyboard shortcuts

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