socat

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2019 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	//Container system
	Container uint8 = iota + 1
	//KVM system
	KVM
)

Variables

This section is empty.

Functions

func ListAll added in v1.5.0

func ListAll(system uint8) (map[NS]PortMap, error)

func RemoveAll

func RemoveAll(ns NS) error

RemoveAll remove all port forwrards that were created in this namespace.

func RemovePortForward

func RemovePortForward(ns NS, host string, dest int) error

RemovePortForward removes a single port forward

func Resolve added in v1.5.0

func Resolve(address string) string

Resolve resolves an address of the form <ip>:<port> to a direct address to the endpoint IF - the ip address is a local address of this machine - port has a forwarding rule ELSE - return address unchanged

func ResolveURL added in v1.5.0

func ResolveURL(raw string) (string, error)

ResolveURL rewrites a url to a direct address to the end point. Return original url if no forwarding rule configured that matches the given address note, the url host part must be an ip, can't use host names

func SetPortForward

func SetPortForward(ns NS, ip string, host string, dest int) error

SetPortForward create a single port forward from host(port), to ip(addr) and dest(port) in this namespace The namespace is used to group port forward rules so they all can get terminated with one call later.

func ValidHost added in v1.2.2

func ValidHost(host string) bool

ValidHost checks if the host string is valid Valid hosts is (port, ip:port, or device:port)

Types

type API added in v1.5.0

type API interface {
	SetPortForward(ns NS, ip string, host string, dest int) error
	RemovePortForward(ns NS, host string, dest int) error
	RemoveAll(ns NS) error
	List(ns NS) (PortMap, error)
	ListAll(system uint8) (map[NS]PortMap, error)
	Resolve(address string) string
	ResolveURL(raw string) (string, error)
	ValidHost(host string) bool
}

type NS added in v1.5.0

type NS uint32

func Namespace added in v1.5.0

func Namespace(system uint8, id uint16) NS

func (NS) String added in v1.5.0

func (n NS) String() string

type PortMap added in v1.5.0

type PortMap map[string]int

func List added in v1.5.0

func List(ns NS) (PortMap, error)

Jump to

Keyboard shortcuts

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