package ip

import "github.com/containernetworking/cni/pkg/ip"

Index

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 EnableIP4Forward

func EnableIP4Forward() error

func EnableIP6Forward

func EnableIP6Forward() error

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 PrevIP

func PrevIP(ip net.IP) net.IP

PrevIP returns IP decremented by 1

func RandomVethName

func RandomVethName() (string, error)

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

func SetupIPMasq

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

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

func SetupVeth

func SetupVeth(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, and will switch back to hostNS to set the host veth end up.

func TeardownIPMasq

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

TeardownIPMasq undoes the effects of SetupIPMasq

Source Files

cidr.go ipforward.go ipmasq.go link.go route.go

Version
v0.2.3
Published
May 12, 2016
Platform
js/wasm
Imports
9 packages
Last checked
11 hours ago

Tools for package owners.