Documentation ¶
Index ¶
- Constants
- Variables
- func AddDefaultRoute(gw net.IP, dev netlink.Link) error
- func AddHostRoute(ipn *net.IPNet, gw net.IP, dev netlink.Link) error
- func AddRoute(ipn *net.IPNet, gw net.IP, dev netlink.Link) error
- func Cmp(a, b net.IP) int
- func DelLinkByName(ifName string) error
- func DelLinkByNameAddr(ifName string) ([]*net.IPNet, error)
- func EnableForward(ips []*current.IPConfig) error
- func EnableIP4Forward() error
- func EnableIP6Forward() error
- func GetVethPeerIfindex(ifName string) (netlink.Link, int, error)
- func Network(ipn *net.IPNet) *net.IPNet
- func NextIP(ip net.IP) net.IP
- func PrevIP(ip net.IP) net.IP
- func RandomVethName() (string, error)
- func RenameLink(curName, newName string) error
- func SetHWAddrByIP(ifName string, ip4 net.IP, ip6 net.IP) error
- func SettleAddresses(ifName string, timeout int) error
- func SetupIPMasq(ipn *net.IPNet, chain string, comment string) error
- func SetupVeth(contVethName string, mtu int, hostNS ns.NetNS) (net.Interface, net.Interface, error)
- func TeardownIPMasq(ipn *net.IPNet, chain string, comment string) error
- func ValidateExpectedInterfaceIPs(ifName string, resultIPs []*current.IPConfig) error
- func ValidateExpectedRoute(resultRoutes []*types.Route) error
Constants ¶
const SETTLE_INTERVAL = 50 * time.Millisecond
Variables ¶
var (
ErrLinkNotFound = errors.New("link not found")
)
Functions ¶
func AddDefaultRoute ¶
AddDefaultRoute sets the default route on the given gateway.
func AddHostRoute ¶
AddHostRoute adds a host-scoped route to a device.
func DelLinkByName ¶
DelLinkByName removes an interface link.
func DelLinkByNameAddr ¶
DelLinkByNameAddr remove an interface and returns its addresses
func EnableForward ¶
EnableForward will enable forwarding for all configured address families
func EnableIP4Forward ¶
func EnableIP4Forward() error
func EnableIP6Forward ¶
func EnableIP6Forward() error
func GetVethPeerIfindex ¶
GetVethPeerIfindex returns the veth link object, the peer ifindex of the veth, or an error. This peer ifindex will only be valid in the peer's network namespace.
func RandomVethName ¶
RandomVethName returns string "veth" with random prefix (hashed from entropy)
func RenameLink ¶
func SettleAddresses ¶
SettleAddresses waits for all addresses on a link to leave tentative state. This is particularly useful for ipv6, where all addresses need to do DAD. There is no easy way to wait for this as an event, so just loop until the addresses are no longer tentative. If any addresses are still tentative after timeout seconds, then error.
func SetupIPMasq ¶
SetupIPMasq installs iptables rules to masquerade traffic coming from ip of ipn and going outside of ipn
func SetupVeth ¶
SetupVeth sets up a pair of virtual ethernet devices. Call SetupVeth from inside the container netns. It will create both veth devices and move the host-side veth into the provided hostNS namespace. On success, SetupVeth returns (hostVeth, containerVeth, nil)
func TeardownIPMasq ¶
TeardownIPMasq undoes the effects of SetupIPMasq
func ValidateExpectedRoute ¶
Types ¶
This section is empty.