ip

package
v0.5.5 Latest Latest
Warning

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

Go to latest
Published: May 1, 2015 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddDefaultRoute

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

AddDefaultRoute sets the default route on the given gateway.

func AddHostRoute

func AddHostRoute(ipn *net.IPNet, gw net.IP, dev netlink.Link) error

AddHostRoute adds a host-scoped route to a device.

func AddRoute

func AddRoute(ipn *net.IPNet, gw net.IP, dev netlink.Link) error

AddRoute adds a universally-scoped route to a device.

func DelLinkByName

func DelLinkByName(ifName string) error

DelLinkByName removes an interface link.

func DelLinkByNameAddr

func DelLinkByNameAddr(ifName string, family int) (*net.IPNet, error)

DelLinkByNameAddr remove an interface returns its IP address of the specified family

func Network

func Network(ipn *net.IPNet) *net.IPNet

Network masks off the host portion of the IP

func NextIP

func NextIP(ip net.IP) net.IP

NextIP returns IP incremented by 1

func ParseCIDR

func ParseCIDR(s string) (*net.IPNet, error)

ParseCIDR takes a string like "10.2.3.1/24" and return IPNet with "10.2.3.1" and /24 mask

func PrevIP

func PrevIP(ip net.IP) net.IP

PrevIP returns IP decremented by 1

func RandomVethName

func RandomVethName(entropy string) string

RandomVethName returns string "veth" with random prefix (hashed from entropy)

func SetupIPMasq

func SetupIPMasq(ipn *net.IPNet, chain string) error

SetupIPMasq installs iptables rules to masquerade traffic coming from ipn and going outside of it

func SetupVeth

func SetupVeth(entropy, contVethName string, mtu int, hostNS *os.File) (hostVeth, contVeth netlink.Link, err error)

SetupVeth sets up a virtual ethernet link. Should be in container netns. TODO(eyakubovich): get rid of entropy and ask kernel to pick name via pattern

func TeardownIPMasq

func TeardownIPMasq(ipn *net.IPNet, chain string) error

TeardownIPMasq undoes the effects of SetupIPMasq

Types

type IPNet

type IPNet net.IPNet

like net.IPNet but adds JSON marshalling and unmarshalling

func (IPNet) MarshalJSON

func (n IPNet) MarshalJSON() ([]byte, error)

func (*IPNet) UnmarshalJSON

func (n *IPNet) UnmarshalJSON(data []byte) error

Jump to

Keyboard shortcuts

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