network

package
v0.0.0-...-3e00b8a Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2020 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Connect

func Connect(networkName string, cinfo *container.ContainerInfo) error

func CreateNetwork

func CreateNetwork(driver, subnet, name string) error

func DeleteNetwork

func DeleteNetwork(networkName string) error

func Disconnect

func Disconnect(networkName string, cinfo *container.ContainerInfo) error

func Init

func Init() error

func ListNetwork

func ListNetwork()

Types

type BridgeNetworkDriver

type BridgeNetworkDriver struct {
}

func (*BridgeNetworkDriver) Connect

func (d *BridgeNetworkDriver) Connect(network *Network, endpoint *Endpoint) error

func (*BridgeNetworkDriver) Create

func (d *BridgeNetworkDriver) Create(subnet string, name string) (*Network, error)

func (*BridgeNetworkDriver) Delete

func (d *BridgeNetworkDriver) Delete(network Network) error

func (*BridgeNetworkDriver) Disconnect

func (d *BridgeNetworkDriver) Disconnect(network Network, endpoint *Endpoint) error

func (*BridgeNetworkDriver) Name

func (d *BridgeNetworkDriver) Name() string

type Endpoint

type Endpoint struct {
	ID          string           `json:"id"`
	Device      netlink.Veth     `json:"dev"`
	IPAddress   net.IP           `json:"ip"`
	MacAddress  net.HardwareAddr `json:"mac"`
	Network     *Network
	PortMapping []string
}

type IPAM

type IPAM struct {
	SubnetAllocatorPath string
	Subnets             *map[string]string
}

func (*IPAM) Allocate

func (ipam *IPAM) Allocate(subnet *net.IPNet) (ip net.IP, err error)

func (*IPAM) Release

func (ipam *IPAM) Release(subnet *net.IPNet, ipaddr *net.IP) error

type Network

type Network struct {
	Name    string
	IpRange *net.IPNet
	Driver  string
}

type NetworkDriver

type NetworkDriver interface {
	Name() string
	Create(subnet string, name string) (*Network, error)
	Delete(network Network) error
	Connect(network *Network, endpoint *Endpoint) error
	Disconnect(network Network, endpoint *Endpoint) error
}

Jump to

Keyboard shortcuts

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