mapping

package
v0.0.0-...-c97221a Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const StageName = "port_mapping"

StageName is used to indicate port mapping NAT traversal stage

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	MapInterface      portmap.Interface
	MapLifetime       time.Duration
	MapUpdateInterval time.Duration
}

Config represents port mapping config.

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig returns default port mapping config.

type PortMapper

type PortMapper interface {
	// Map maps port for given protocol. It returns release func which
	// must be called when port no longer needed and ok which is true if
	// port mapping was successful.
	Map(id, protocol string, port int, name string) (release func(), ok bool)
}

PortMapper tries to map port using router's uPnP or NAT-PMP depending on given config map interface.

func NewNoopPortMapper

func NewNoopPortMapper(publisher eventbus.Publisher) PortMapper

NewNoopPortMapper returns noop port mapper instance.

func NewPortMapper

func NewPortMapper(config *Config, publisher eventbus.Publisher) PortMapper

NewPortMapper returns port mapper instance.

Jump to

Keyboard shortcuts

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