lxt

package
v0.0.0-...-f1de9f1 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2016 License: GPL-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoDefaultInterfaceFound = errors.New(`Failed to find default interface`)

Functions

func AnsibleFacts

func AnsibleFacts() *commander.Command

func AutoStartCommand

func AutoStartCommand() *commander.Command

func CPathCommand

func CPathCommand() *commander.Command

func ContainerizePath

func ContainerizePath(p string) (string, error)

ContainerizePath takes a path that potentially starts with containerName:/path/ and turns it into a full path on the local machine.

func CopyCommand

func CopyCommand() *commander.Command

func CopyFile

func CopyFile(src, dest string) error

func DefaultInterface

func DefaultInterface() (string, error)

DefaultInterface returns the name of the default interface on this system (eg 'eth0')

func EditLxcAddLine

func EditLxcAddLine(n string, find, duplicate *regexp.Regexp, line string) error

EditLxcAddLine adds a line to the LXC config file. It will add the line line, after it finds a line matching the `find` regexp. It will remove any line matching the 'duplicate' regexp. `n` is the name of the container to whose config this is being added.

func EnsureChain

func EnsureChain(chain string) error

EnsureChain ensures that the chain exists, creating it if it does not.

func ExistsCommand

func ExistsCommand() *commander.Command

func ExistsContainer

func ExistsContainer(name string) (bool, error)

func ExposePort

func ExposePort(n string, containerPort, hostPort int) error

ExposePort is going to expose a containerPort on the Host. The basic iptables commands to accomplish this are: #sudo iptables -N PHPC #sudo iptables -A PHPC -p tcp -d 10.0.3.192 --dport 80 -j ACCEPT #sudo iptables -A PHPC -j DROP #sudo iptables -A FORWARD -i eth0 -o lxcbr0 -j PHPC #sudo iptables -A FORWARD -j DROP # not sure if this is necessary sudo iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j DNAT --to 10.0.3.192:80

func ExposePortCommand

func ExposePortCommand() *commander.Command

func FixIP

func FixIP(containerName string, ip string) error

FixIP sets the IP of the named container to the given ip in the string, or to the container's current IP if the container is running.

func FixIPCommand

func FixIPCommand() *commander.Command

func GetDefinedContainer

func GetDefinedContainer(n string) (*lxc.Container, error)

func GetIP

func GetIP(containerName string) (string, error)

GetIP returns the IPv4 of the named container, or an error if the container does not exist.

func GetIPCommand

func GetIPCommand() *commander.Command

func GetSSHKey

func GetSSHKey(name string) (string, error)

GetSSHKey gets the public SSH key for the given container

func HostCommand

func HostCommand() *commander.Command

func IPTables

func IPTables(args ...string) (success bool, err error)

func IsDir

func IsDir(p string) (bool, error)

IsDir returns true if the given path is a directory, false otherwise

func LinkDirIntoContainer

func LinkDirIntoContainer(n, src, dest string) error

func LnCommand

func LnCommand() *commander.Command

func MakeDir

func MakeDir(fn string) error

func MakeWriter

func MakeWriter(a bool, fn string) (out io.WriteCloser, err error)

func PortForward

func PortForward(containerName string, portToForward int, destinationPort int) error

func PortForwardCommand

func PortForwardCommand() *commander.Command

func SSHKeyCommand

func SSHKeyCommand() *commander.Command

func SSHKeyScan

func SSHKeyScan(name string, euser string) error

SSHKeyScan adds the host keys for the named container to the current user's known hosts.

func SSHKeyScanCommand

func SSHKeyScanCommand() *commander.Command

func SaveIPTablesRules

func SaveIPTablesRules() error

func SetContainerAutoStart

func SetContainerAutoStart(n string, autostart bool) error

func SetSudoer

func SetSudoer(n, u string) error

func Shell

func Shell(n, script string) error

func ShellCommand

func ShellCommand() *commander.Command

func SudoerCommand

func SudoerCommand() *commander.Command

func Tee

func Tee(a bool, out []string) (err error)

func TeeCommand

func TeeCommand() *commander.Command

func WriteAnsibleFact

func WriteAnsibleFact() *commander.Command

Types

This section is empty.

Jump to

Keyboard shortcuts

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