nettool

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Copyright 2015-2017 CNI authors

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 CreateOrUpdateBridge

func CreateOrUpdateBridge(name, ip string, mtu int) (*netlink.Bridge, error)

CreateOrUpdateBridge creates or updates bridge and sets its as the gateway of container network

func GetAllIPs

func GetAllIPs(cidr string) ([]string, error)

func GetVethIPInNS

func GetVethIPInNS(netns ns.NetNS, ifName string) (string, error)

GetVethIPInNS return the IP address for the ifName in container Namespace

func SetupVeth

func SetupVeth(netns ns.NetNS, br *netlink.Bridge, ifName, ip, gwip string, mtu int) error

SetupVeth sets up a pair of virtual ethernet devices in container netns and then move the host-side veth into the hostNS namespace.

Types

type AllocatedIP

type AllocatedIP struct {
	Version string `json:"version"`
	Address string `json:"address"`
	Gateway string `json:"gateway"`
}

Jump to

Keyboard shortcuts

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