portforward

package
v0.0.0-...-1e25372 Latest Latest
Warning

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

Go to latest
Published: May 10, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Logger

type Logger interface {
	Debug(s string)
	Info(s string)
	Warn(s string)
	Error(s string)
}

type Loop

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

func NewLoop

func NewLoop(settings settings.PortForwarding, routing Routing,
	client *http.Client, portAllower PortAllower,
	logger Logger, uid, gid int) *Loop

func (*Loop) GetPortForwarded

func (l *Loop) GetPortForwarded() (port uint16)

func (*Loop) Start

func (l *Loop) Start(_ context.Context) (runError <-chan error, _ error)

func (*Loop) Stop

func (l *Loop) Stop() (err error)

func (*Loop) String

func (l *Loop) String() string

func (*Loop) UpdateWith

func (l *Loop) UpdateWith(partialUpdate Settings) (err error)

type PortAllower

type PortAllower interface {
	SetAllowedPort(ctx context.Context, port uint16, intf string) (err error)
	RemoveAllowedPort(ctx context.Context, port uint16) (err error)
	RedirectPort(ctx context.Context, intf string, sourcePort,
		destinationPort uint16) (err error)
}

type Routing

type Routing interface {
	VPNLocalGatewayIP(vpnInterface string) (gateway netip.Addr, err error)
}

type Service

type Service interface {
	Start(ctx context.Context) (runError <-chan error, err error)
	Stop() (err error)
	GetPortForwarded() (port uint16)
}

type Settings

type Settings struct {
	// VPNIsUp can be optionally set to signal the loop
	// the VPN is up (true) or down (false). If left to nil,
	// it is assumed the VPN is in the same previous state.
	VPNIsUp *bool
	Service service.Settings
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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