api

package
v0.8.2 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2019 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package api provides koko's connector funcitionlity as API.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddMacVLanInterface

func AddMacVLanInterface(macvlan MacVLan, devName string) (err error)

AddMacVLanInterface creates MacVLan interface by given macvlan object

func AddVLanInterface

func AddVLanInterface(vlan VLan, devName string) (err error)

AddVLanInterface creates VLan interface by given vlan object

func AddVxLanInterface

func AddVxLanInterface(vxlan VxLan, devName string) (err error)

AddVxLanInterface creates VxLan interface by given vxlan object

func GetDockerContainerNS

func GetDockerContainerNS(procPrefix, containerID string) (namespace string, err error)

GetDockerContainerNS retrieves container's network namespace from docker container id, given as containerID.

func GetVethPair

func GetVethPair(name1 string, name2 string) (link1 netlink.Link,
	link2 netlink.Link, err error)

GetVethPair takes two link names and create a veth pair and return both links.

func IsExistLinkInNS

func IsExistLinkInNS(nsName string, linkName string) (result bool, err error)

IsExistLinkInNS finds interface name in given namespace. if foud return true. otherwise false.

func MakeMacVLan

func MakeMacVLan(veth1 VEth, macvlan MacVLan) (err error)

MakeMacVLan makes macvlan interface

func MakeVLan

func MakeVLan(veth1 VEth, vlan VLan) (err error)

MakeVLan makes vlan interface

func MakeVeth

func MakeVeth(veth1 VEth, veth2 VEth) (err error)

MakeVeth is top-level handler to create veth links given two VEth data objects: veth1 and veth2.

func MakeVethPair

func MakeVethPair(name, peer string, mtu int) (netlink.Link, error)

MakeVethPair makes veth pair and returns its link.

func MakeVxLan

func MakeVxLan(veth1 VEth, vxlan VxLan) (err error)

MakeVxLan makes vxlan interface and put it into container namespace

func RandomName

func RandomName() string

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

Types

type MacVLan

type MacVLan struct {
	ParentIF string              // parent interface name
	Mode     netlink.MacvlanMode // MacVlan mode
}

MacVLan is a structure to descrive vlan endpoint.

type VEth

type VEth struct {
	NsName        string      // What's the network namespace?
	LinkName      string      // And what will we call the link.
	IPAddr        []net.IPNet // (optional) Slice of IPv4/v6 address.
	MirrorEgress  string      // (optional) source interface for egress mirror
	MirrorIngress string      // (optional) source interface for ingress mirror
}

VEth is a structure to descrive veth interfaces.

func (veth *VEth) RemoveVethLink() (err error)

RemoveVethLink is low-level handler to get interface handle in container/netns namespace and remove it.

func (*VEth) SetEgressMirror

func (veth *VEth) SetEgressMirror() (err error)

SetEgressMirror sets TC to mirror egress from given port as MirrorEgress.

func (*VEth) SetIngressMirror

func (veth *VEth) SetIngressMirror() (err error)

SetIngressMirror sets TC to mirror ingress from given port as MirrorIngress.

func (veth *VEth) SetVethLink(link netlink.Link) (err error)

SetVethLink is low-level handler to set IP address onveth links given a single VEth data object. ...primarily used privately by makeVeth().

func (*VEth) UnsetEgressMirror

func (veth *VEth) UnsetEgressMirror() (err error)

UnsetEgressMirror sets TC to mirror egress from given port as MirrorEgress.

func (*VEth) UnsetIngressMirror

func (veth *VEth) UnsetIngressMirror() (err error)

UnsetIngressMirror sets TC to mirror ingress from given port as MirrorIngress.

type VLan

type VLan struct {
	ParentIF string // parent interface name
	ID       int    // VLan ID
}

VLan is a structure to descrive vlan endpoint.

type VxLan

type VxLan struct {
	ParentIF string // parent interface name
	ID       int    // VxLan ID
	IPAddr   net.IP // VxLan destination address
}

VxLan is a structure to descrive vxlan endpoint.

Jump to

Keyboard shortcuts

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