network

package
v0.4.6 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2018 License: GPL-3.0 Imports: 34 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewL2TPEndpoint

func NewL2TPEndpoint(netInfo *l2tpNetwork) *l2tpEndpoint

Types

type Cleanup

type Cleanup interface {
	Close() error
}

type IP4

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

A comparable type for v4 address

func (*IP4) ToCommon

func (i *IP4) ToCommon() net.IP

type IPAMDriver

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

func NewIPAMDriver

func NewIPAMDriver(ctx context.Context, state *l2tpState) *IPAMDriver

func (IPAMDriver) AddNetwork

func (s IPAMDriver) AddNetwork(netID string, netInfo *l2tpNetwork) error

func (IPAMDriver) AddNetworkAlias

func (s IPAMDriver) AddNetworkAlias(netID, alias string) error

func (*IPAMDriver) GetCapabilities

func (d *IPAMDriver) GetCapabilities() (*ipam.CapabilitiesResponse, error)

func (*IPAMDriver) GetDefaultAddressSpaces

func (d *IPAMDriver) GetDefaultAddressSpaces() (*ipam.AddressSpacesResponse, error)

func (IPAMDriver) GetNetwork

func (s IPAMDriver) GetNetwork(netID string) (*l2tpNetwork, error)

func (*IPAMDriver) ReleaseAddress

func (d *IPAMDriver) ReleaseAddress(request *ipam.ReleaseAddressRequest) error

func (*IPAMDriver) ReleasePool

func (d *IPAMDriver) ReleasePool(request *ipam.ReleasePoolRequest) error

func (IPAMDriver) RemoveNetwork

func (s IPAMDriver) RemoveNetwork(netID string) error

func (*IPAMDriver) RequestAddress

func (d *IPAMDriver) RequestAddress(request *ipam.RequestAddressRequest) (*ipam.RequestAddressResponse, error)

func (*IPAMDriver) RequestPool

func (d *IPAMDriver) RequestPool(request *ipam.RequestPoolRequest) (*ipam.RequestPoolResponse, error)

type L2TPCleaner

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

func (*L2TPCleaner) Close

func (t *L2TPCleaner) Close() error

type L2TPConfig

type L2TPConfig struct {
	Enabled        bool   `yaml:"enabled"`
	NetSocketPath  string `required:"false" yaml:"net_socket_path" default:"/run/docker/plugins/l2tp_net.sock"`
	IPAMSocketPath string `required:"false" yaml:"ipam_socket_path" default:"/run/docker/plugins/l2tp_ipam.sock"`
	ConfigDir      string `required:"false" yaml:"config_dir" default:"/tmp/sonm/l2tp/"`
	StatePath      string `required:"false" yaml:"state_path" default:"/tmp/sonm/l2tp/l2tp_network_state"`
}

type L2TPNetworkDriver

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

func NewL2TPDriver

func NewL2TPDriver(ctx context.Context, state *l2tpState) *L2TPNetworkDriver

func (L2TPNetworkDriver) AddNetwork

func (s L2TPNetworkDriver) AddNetwork(netID string, netInfo *l2tpNetwork) error

func (L2TPNetworkDriver) AddNetworkAlias

func (s L2TPNetworkDriver) AddNetworkAlias(netID, alias string) error

func (*L2TPNetworkDriver) AllocateNetwork

func (*L2TPNetworkDriver) CreateEndpoint

func (*L2TPNetworkDriver) CreateNetwork

func (d *L2TPNetworkDriver) CreateNetwork(request *network.CreateNetworkRequest) error

func (*L2TPNetworkDriver) DeleteEndpoint

func (d *L2TPNetworkDriver) DeleteEndpoint(request *network.DeleteEndpointRequest) error

func (*L2TPNetworkDriver) DeleteNetwork

func (d *L2TPNetworkDriver) DeleteNetwork(request *network.DeleteNetworkRequest) error

func (*L2TPNetworkDriver) DiscoverDelete

func (d *L2TPNetworkDriver) DiscoverDelete(request *network.DiscoveryNotification) error

func (*L2TPNetworkDriver) DiscoverNew

func (d *L2TPNetworkDriver) DiscoverNew(request *network.DiscoveryNotification) error

func (*L2TPNetworkDriver) EndpointInfo

func (d *L2TPNetworkDriver) EndpointInfo(request *network.InfoRequest) (*network.InfoResponse, error)

func (*L2TPNetworkDriver) FreeNetwork

func (d *L2TPNetworkDriver) FreeNetwork(request *network.FreeNetworkRequest) error

func (*L2TPNetworkDriver) GetCapabilities

func (d *L2TPNetworkDriver) GetCapabilities() (*network.CapabilitiesResponse, error)

func (L2TPNetworkDriver) GetNetwork

func (s L2TPNetworkDriver) GetNetwork(netID string) (*l2tpNetwork, error)

func (*L2TPNetworkDriver) Join

func (*L2TPNetworkDriver) Leave

func (d *L2TPNetworkDriver) Leave(request *network.LeaveRequest) error

func (*L2TPNetworkDriver) ProgramExternalConnectivity

func (d *L2TPNetworkDriver) ProgramExternalConnectivity(request *network.ProgramExternalConnectivityRequest) error

func (L2TPNetworkDriver) RemoveNetwork

func (s L2TPNetworkDriver) RemoveNetwork(netID string) error

func (*L2TPNetworkDriver) RevokeExternalConnectivity

func (d *L2TPNetworkDriver) RevokeExternalConnectivity(request *network.RevokeExternalConnectivityRequest) error

type L2TPTuner

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

func NewL2TPTuner

func NewL2TPTuner(ctx context.Context, cfg *L2TPConfig) (*L2TPTuner, error)

func (*L2TPTuner) GenerateInvitation

func (t *L2TPTuner) GenerateInvitation(ID string) (*structs.NetworkSpec, error)

func (*L2TPTuner) GetCleaner added in v0.4.6

func (t *L2TPTuner) GetCleaner(ctx context.Context, ID string) (Cleanup, error)

func (*L2TPTuner) Run

func (t *L2TPTuner) Run(ctx context.Context) error

func (*L2TPTuner) Tune

func (*L2TPTuner) Tuned

func (t *L2TPTuner) Tuned(ID string) bool

type TincCleaner

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

func (*TincCleaner) Close

func (t *TincCleaner) Close() (err error)

type TincIPAMDriver

type TincIPAMDriver struct {
	*TincNetworkState
	// contains filtered or unexported fields
}

func NewTincIPAMDriver

func NewTincIPAMDriver(ctx context.Context, state *TincNetworkState, config *TincNetworkConfig) (*TincIPAMDriver, error)

func (*TincIPAMDriver) GetCapabilities

func (t *TincIPAMDriver) GetCapabilities() (*ipam.CapabilitiesResponse, error)

func (*TincIPAMDriver) GetDefaultAddressSpaces

func (t *TincIPAMDriver) GetDefaultAddressSpaces() (*ipam.AddressSpacesResponse, error)

func (*TincIPAMDriver) ReleaseAddress

func (t *TincIPAMDriver) ReleaseAddress(request *ipam.ReleaseAddressRequest) error

func (*TincIPAMDriver) ReleasePool

func (t *TincIPAMDriver) ReleasePool(request *ipam.ReleasePoolRequest) error

func (*TincIPAMDriver) RequestAddress

func (*TincIPAMDriver) RequestPool

func (t *TincIPAMDriver) RequestPool(request *ipam.RequestPoolRequest) (*ipam.RequestPoolResponse, error)

type TincNetwork

type TincNetwork struct {
	NodeID       string
	DockerID     string
	Pool         *net.IPNet
	Invitation   string
	EnableBridge bool
	CgroupParent string

	ConfigPath      string
	TincContainerID string
	// contains filtered or unexported fields
}

func (*TincNetwork) Init

func (t *TincNetwork) Init(ctx context.Context) error

func (*TincNetwork) Invite

func (t *TincNetwork) Invite(ctx context.Context, inviteeID string) (string, error)

func (*TincNetwork) Join

func (t *TincNetwork) Join(ctx context.Context) error

func (*TincNetwork) OccupiedIPs

func (t *TincNetwork) OccupiedIPs(ctx context.Context) (map[IP4]struct{}, error)

func (*TincNetwork) Shutdown

func (t *TincNetwork) Shutdown(ctx context.Context) error

func (*TincNetwork) Start

func (t *TincNetwork) Start(ctx context.Context, addr string) error

func (*TincNetwork) Stop

func (t *TincNetwork) Stop(ctx context.Context) error

type TincNetworkConfig

type TincNetworkConfig struct {
	Enabled                  bool   `yaml:"enabled"`
	ConfigDir                string `yaml:"config_dir" default:"/tinc"`
	DockerNetPluginSockPath  string `yaml:"docker_net_plugin_dir" default:"/run/docker/plugins/tinc/tinc.sock"`
	DockerIPAMPluginSockPath string `yaml:"docker_ipam_plugin_dir" default:"/run/docker/plugins/tincipam/tincipam.sock"`
	DockerImage              string `yaml:"docker_image" default:"sonm/tinc"`
	StatePath                string `yaml:"state_path" default:"/var/lib/sonm/tinc_network_state"`
}

type TincNetworkDriver

type TincNetworkDriver struct {
	*TincNetworkState
	// contains filtered or unexported fields
}

func (*TincNetworkDriver) AllocateNetwork

func (*TincNetworkDriver) CreateEndpoint

func (*TincNetworkDriver) CreateNetwork

func (t *TincNetworkDriver) CreateNetwork(request *network.CreateNetworkRequest) error

func (*TincNetworkDriver) DeleteEndpoint

func (t *TincNetworkDriver) DeleteEndpoint(request *network.DeleteEndpointRequest) error

func (*TincNetworkDriver) DeleteNetwork

func (t *TincNetworkDriver) DeleteNetwork(request *network.DeleteNetworkRequest) error

func (*TincNetworkDriver) DiscoverDelete

func (t *TincNetworkDriver) DiscoverDelete(request *network.DiscoveryNotification) error

func (*TincNetworkDriver) DiscoverNew

func (t *TincNetworkDriver) DiscoverNew(request *network.DiscoveryNotification) error

func (*TincNetworkDriver) EndpointInfo

func (t *TincNetworkDriver) EndpointInfo(request *network.InfoRequest) (*network.InfoResponse, error)

func (*TincNetworkDriver) FreeNetwork

func (t *TincNetworkDriver) FreeNetwork(request *network.FreeNetworkRequest) error

func (*TincNetworkDriver) GenerateInvitation

func (t *TincNetworkDriver) GenerateInvitation(NodeID string) (*structs.NetworkSpec, error)

func (*TincNetworkDriver) GetCapabilities

func (t *TincNetworkDriver) GetCapabilities() (*network.CapabilitiesResponse, error)

func (*TincNetworkDriver) HasNetwork

func (t *TincNetworkDriver) HasNetwork(NodeID string) bool

func (*TincNetworkDriver) Join

func (*TincNetworkDriver) Leave

func (t *TincNetworkDriver) Leave(request *network.LeaveRequest) error

func (*TincNetworkDriver) ProgramExternalConnectivity

func (t *TincNetworkDriver) ProgramExternalConnectivity(request *network.ProgramExternalConnectivityRequest) error

func (*TincNetworkDriver) RevokeExternalConnectivity

func (t *TincNetworkDriver) RevokeExternalConnectivity(request *network.RevokeExternalConnectivityRequest) error

type TincNetworkState

type TincNetworkState struct {
	Networks map[string]*TincNetwork
	Pools    map[string]*net.IPNet
	// contains filtered or unexported fields
}

func (*TincNetworkState) InsertTincNetwork

func (t *TincNetworkState) InsertTincNetwork(n *structs.NetworkSpec, cgroupParent string) (*TincNetwork, error)

type TincTuner

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

func NewTincTuner

func NewTincTuner(ctx context.Context, config *TincNetworkConfig) (*TincTuner, error)

func (*TincTuner) GenerateInvitation

func (t *TincTuner) GenerateInvitation(ID string) (*structs.NetworkSpec, error)

func (*TincTuner) GetCleaner added in v0.4.6

func (t *TincTuner) GetCleaner(ctx context.Context, ID string) (Cleanup, error)

func (*TincTuner) Tune

func (*TincTuner) Tuned

func (t *TincTuner) Tuned(ID string) bool

type Tuner

type Tuner interface {
	Tune(ctx context.Context, net *structs.NetworkSpec, hostConfig *container.HostConfig, netConfig *network.NetworkingConfig) (Cleanup, error)
	GenerateInvitation(ID string) (*structs.NetworkSpec, error)
	GetCleaner(ctx context.Context, ID string) (Cleanup, error)
	Tuned(ID string) bool
}

Tuner is responsible for preparing networking and baking proper options in container.HostConfig and network.NetworkingConfig.

Jump to

Keyboard shortcuts

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