base

package
v0.0.0-...-481599e Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2015 License: BSD-3-Clause Imports: 3 Imported by: 6

Documentation

Overview

Package base defines the common interface for the various NAT port forwarding configuration methods.

Index

Constants

View Source
const (
	// VlogPrefix is the verbose logging output prefix.
	VlogPrefix = "V: "
)

Variables

This section is empty.

Functions

func Vlogf

func Vlogf(f string, a ...interface{})

Vlogf logs verbose debugging messages to stderr.

Types

type Client

type Client interface {
	// AddPortMapping adds a new TCP/IP port forwarding entry between
	// clientIP:internalPort and 0.0.0.0:externalPort.  A duration of "0" will
	// have the backend pick an "appropriate" and "safe" duration.
	AddPortMapping(description string, internalPort, externalPort, duration int) error

	// DeletePortMapping removes an existing TCP/IP port forwarding entry
	// between clientIP:internalPort and 0.0.0.0:externalPort.
	DeletePortMapping(internalPort, externalPort int) error

	// GetExternalIPAddress queries the router for the external public IP
	// address.
	GetExternalIPAddress() (net.IP, error)

	// GetListOfPortMappings queries the router for the list of port forwarding
	// entries, and returns all that were found as a string slice.  Each string
	// in the slice is of the format "'description' internalIP:internalPort <->
	// externalIP:externalPort protocol (leaseDuration sec)".
	GetListOfPortMappings() ([]string, error)

	// Vlogf logs verbose debugging messages to stderror.  It is up to the
	// implementation to squelch output when constructed with verbose = false.
	Vlogf(f string, a ...interface{})

	// Close cleans up all the state associated with the particular Client.
	Close()
}

Client is a NAT port forwarding mechanism configuration client.

type ClientFactory

type ClientFactory interface {
	// Name returns the name of the port forwarding configuration mechanism.
	Name() string

	// Initializes and probes for a suitable configuration mechanism and
	// returns a ready to use Client.
	New(verbose bool) (Client, error)
}

ClientFactory is a Client factory.

Jump to

Keyboard shortcuts

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