Documentation ¶
Index ¶
Constants ¶
const ( // ContainerStarted matches the text used in monitoring for a Container Starting up ContainerStarted = "ContainerStart" // ContainerStopped matches the text used in monitoring for a Container shutting down or being stopped ContainerStopped = "ContainerStop" // IPTable is the table that all IPTable rules should be added to IPTable = "nat" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
Forwards map[string][]PortMappings `yaml:",inline"`
}
Config represents the Config File format that can be stored in YAML format
func LoadYAMLConfig ¶
LoadYAMLConfig loads a YAML Port Forwarding config file and builds the appropriate config
type Direction ¶
type Direction int
Direction is used to define the direction of traffic aka if the host is the source or destination of traffic
type Forwarder ¶
Forwarder represents a port forwarding client that can setup and teardown port forwarding for LXD containers
func NewForwarder ¶
NewForwarder validates the provided config then creates and returns port forward client
func (Forwarder) Forward ¶
Forward enables forwarding for all containers and port mappings provided in the client config
func (Forwarder) ForwardContainer ¶
ForwardContainer turns on port forwarding for the provided container Uses iptables to place ipv4 and ipv6 port forwarding rules
func (Forwarder) Reverse ¶
Reverse disables forwarding for all containers and port mappings provided in the client config
func (Forwarder) ReverseContainer ¶
ReverseContainer removes port forwarding for the provided container
type IPVersion ¶
type IPVersion int
IPVersion is used to modify IPTables rules as needed for iptables vs ip6tables
type PortMappings ¶
type PortMappings struct { // Name of the container - May be left empty in YAML config file Name string `yaml:"name,omitempty"` // Protocol should be "tcp" or "udp" Protocol string `yaml:"protocol"` // Ports is a mapping of host ports as keys to container ports as values Ports map[string]int `yaml:",inline"` }
PortMappings contains information for mapping ports from a host to a container
func NewPortMappings ¶
func NewPortMappings() PortMappings
NewPortMappings initializes and returns an empty PortMappings struct