networking

package
v0.0.0-...-baa748c Latest Latest
Warning

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

Go to latest
Published: May 7, 2020 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddDefaultRoute

func AddDefaultRoute(ip net.IP, dev netlink.Link) error

func AttachVethToBridge

func AttachVethToBridge(veth netlink.Link, bridge netlink.Link) error

func CalculateContainerIP

func CalculateContainerIP(cid int) (net.IP, error)

func CreateVeth

func CreateVeth() (netlink.Link, netlink.Link, error)

func EnableIPForward

func EnableIPForward() error

func ExecInNS

func ExecInNS(pid int, fn func() error) error

func GetCIDR

func GetCIDR(ip net.IP, mask net.IPMask) string

func Masquerade

func Masquerade(bridge Bridge) error

Types

type Bridge

type Bridge struct {
	Name string
	Link netlink.Link
	IP   net.IP
	Mask net.IPMask
}

func CreateBridge

func CreateBridge(name string, ip net.IP, mask net.IPMask) (Bridge, error)

func EnvSetup

func EnvSetup() (Bridge, error)

type Container

type Container struct {
	PID     int
	IP      net.IP
	InVeth  netlink.Link
	OutVeth netlink.Link
	Bridge  Bridge
}

func ContainerSetup

func ContainerSetup(pid int, cid int, bridge Bridge) (Container, error)

Jump to

Keyboard shortcuts

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