nr

package
v0.6.0-rc3 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2021 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Convert4to6 added in v0.4.9

func Convert4to6(netID string, ip net.IP) net.IP

Convert4to6 converts a (private) ipv4 to the corresponding ipv6

Types

type ContainerConfig added in v0.4.9

type ContainerConfig struct {
	ContainerID string
	IPs         []net.IP
	PublicIP6   bool //true if the container must have a public ipv6
	IPv4Only    bool // describe the state of the node, true mean it runs in ipv4 only mode
}

ContainerConfig is an object used to pass the required network configuration for a container

type NetResource

type NetResource struct {
	// contains filtered or unexported fields
}

NetResource holds the logic to configure an network resource

func New

func New(nr pkg.NetResource) (*NetResource, error)

New creates a new NetResource object iprange is the full network subnet

func (*NetResource) BridgeName

func (nr *NetResource) BridgeName() (string, error)

BridgeName returns the name of the bridge to create for the network resource in the host network namespace

func (*NetResource) ConfigureWG

func (nr *NetResource) ConfigureWG(privateKey string) error

ConfigureWG sets the routes and IP addresses on the wireguard interface of the network resources

func (*NetResource) Create

func (nr *NetResource) Create() error

Create setup the basic components of the network resource network namespace, bridge, wireguard interface and veth pair

func (*NetResource) Delete

func (nr *NetResource) Delete() error

Delete removes all the interfaces and namespaces created by the Create method

func (*NetResource) HasWireguard added in v0.4.9

func (nr *NetResource) HasWireguard() (bool, error)

HasWireguard checks if network resource has wireguard setup up

func (*NetResource) ID

func (nr *NetResource) ID() string

ID returns the network ID in which the NetResource is defined

func (*NetResource) Join

func (nr *NetResource) Join(cfg ContainerConfig) (join pkg.Member, err error)

Join make a network namespace of a container join a network resource network

func (*NetResource) Leave

func (nr *NetResource) Leave(containerID string) error

Leave delete a container network namespace

func (*NetResource) NRIface

func (nr *NetResource) NRIface() (string, error)

NRIface returns name of netresource local interface

func (*NetResource) Namespace

func (nr *NetResource) Namespace() (string, error)

Namespace returns the name of the network namespace to create for the network resource

func (*NetResource) SetWireguard added in v0.4.9

func (nr *NetResource) SetWireguard(wg *wireguard.Wireguard) error

SetWireguard sets wireguard of this network resource

func (*NetResource) String

func (nr *NetResource) String() string

func (*NetResource) WGName

func (nr *NetResource) WGName() (string, error)

WGName returns the name of the wireguard interface to create for the network resource

Jump to

Keyboard shortcuts

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