nic

package
v0.2.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// InterfacesPrefix defines the string prepended to each interface name.
	// Example: if InterfacePrefix is "abc", interfaces will be named as
	// "abc-xxxxxx", where "xxxxxx" is a random string.
	InterfacesPrefix string

	// WireguardPath is the path to a userspace Wireguard binary. In case
	// it is not defined, Drago will try to use the kernel module.
	WireguardPath string

	// KeyStore is an implementation of the KeyStore interface, used by the
	// Controller to cache private keys for each interface.
	KeyStore PrivateKeyStore
}

Config contains configurations for a network controller.

type Controller

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

Controller : network interface controller.

func NewController

func NewController(config *Config) (*Controller, error)

NewController :

func (*Controller) CreateInterface

func (c *Controller) CreateInterface(iface *structs.Interface) error

CreateInterface ...

func (*Controller) DeleteAllInterfaces

func (c *Controller) DeleteAllInterfaces() error

DeleteAllInterfaces deletes all network interfaces and routes.

func (*Controller) DeleteInterfaceByAlias

func (c *Controller) DeleteInterfaceByAlias(s string) error

DeleteInterfaceByAlias deletes a network interface and all associated routes by alias.

func (*Controller) DeleteInterfaceByName

func (c *Controller) DeleteInterfaceByName(s string) error

DeleteInterfaceByName deletes a network interface and all associated routes by name.

func (*Controller) Interfaces

func (c *Controller) Interfaces() ([]*structs.Interface, error)

Interfaces returns a slice of all network interfaces managed by the controller.

func (*Controller) UpdateInterface

func (c *Controller) UpdateInterface(iface *structs.Interface) error

UpdateInterface :

type NetworkInterfaceController

type NetworkInterfaceController interface {
	Interfaces() ([]*structs.Interface, error)
	CreateInterface(iface *structs.Interface) error
	UpdateInterface(iface *structs.Interface) error
	DeleteInterfaceByAlias(s string) error
	DeleteInterfaceByName(s string) error
	DeleteAllInterfaces() error
}

NetworkInterfaceController provides network configuration capabilities.

type PrivateKey

type PrivateKey struct {
	ID        string
	Key       string
	CreatedAt int64
}

type PrivateKeyStore

type PrivateKeyStore interface {
	KeyByID(id string) (*PrivateKey, error)
	UpsertKey(key *PrivateKey) error
	DeleteKey(id string) error
}

Jump to

Keyboard shortcuts

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