portforward

package
v0.70.2 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2026 License: BSD-3-Clause Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

func NewManager

func NewManager() *Manager

NewManager creates a new port forwarding manager.

func (*Manager) GetMapping

func (m *Manager) GetMapping() *Mapping

GetMapping returns the current mapping if ready, nil otherwise

func (*Manager) GracefullyStop

func (m *Manager) GracefullyStop(ctx context.Context) error

GracefullyStop cancels the manager and attempts to delete the port mapping. After GracefullyStop returns, the manager cannot be restarted.

func (*Manager) Start

func (m *Manager) Start(ctx context.Context, wgPort uint16)

type Mapping

type Mapping struct {
	Protocol     string
	InternalPort uint16
	ExternalPort uint16
	ExternalIP   net.IP
	NATType      string
	// TTL is the lease duration. Zero means a permanent lease that never expires.
	TTL time.Duration
}

Mapping represents an active NAT port mapping.

type State

type State struct {
	InternalPort uint16 `json:"internal_port,omitempty"`
	Protocol     string `json:"protocol,omitempty"`
}

State is persisted only for crash recovery cleanup

func (*State) Cleanup

func (s *State) Cleanup() error

Cleanup implements statemanager.CleanableState for crash recovery

func (*State) Name

func (s *State) Name() string

Directories

Path Synopsis
Package pcp implements the Port Control Protocol (RFC 6887).
Package pcp implements the Port Control Protocol (RFC 6887).

Jump to

Keyboard shortcuts

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