Documentation ¶
Index ¶
- func Convert4to6(netID string, ip net.IP) net.IP
- type ContainerConfig
- type NetResource
- func (nr *NetResource) BridgeName() (string, error)
- func (nr *NetResource) ConfigureWG(privateKey string) error
- func (nr *NetResource) Create() error
- func (nr *NetResource) Delete() error
- func (nr *NetResource) HasWireguard() (bool, error)
- func (nr *NetResource) ID() string
- func (nr *NetResource) Join(cfg ContainerConfig) (join pkg.Member, err error)
- func (nr *NetResource) Leave(containerID string) error
- func (nr *NetResource) NRIface() (string, error)
- func (nr *NetResource) Namespace() (string, error)
- func (nr *NetResource) SetWireguard(wg *wireguard.Wireguard) error
- func (nr *NetResource) String() string
- func (nr *NetResource) WGName() (string, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
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