Documentation ¶
Index ¶
- func NewL2TPEndpoint(netInfo *l2tpNetwork) *l2tpEndpoint
- func NewTinc(ctx context.Context, client *client.Client, config *TincNetworkConfig) (*TincNetworkDriver, *TincIPAMDriver, error)
- type Action
- type ActionQueue
- type Cleanup
- type CreateNetworkRequest
- type DockerNetworkCreateAction
- type HTBShapingAction
- type IP4
- type IPAMDriver
- func (s IPAMDriver) AddNetwork(netID string, netInfo *l2tpNetwork) error
- func (s IPAMDriver) AddNetworkAlias(netID, alias string) error
- func (d *IPAMDriver) GetCapabilities() (*ipam.CapabilitiesResponse, error)
- func (d *IPAMDriver) GetDefaultAddressSpaces() (*ipam.AddressSpacesResponse, error)
- func (s IPAMDriver) GetNetwork(netID string) (*l2tpNetwork, error)
- func (d *IPAMDriver) ReleaseAddress(request *ipam.ReleaseAddressRequest) error
- func (d *IPAMDriver) ReleasePool(request *ipam.ReleasePoolRequest) error
- func (s IPAMDriver) RemoveNetwork(netID string) error
- func (d *IPAMDriver) RequestAddress(request *ipam.RequestAddressRequest) (*ipam.RequestAddressResponse, error)
- func (d *IPAMDriver) RequestPool(request *ipam.RequestPoolRequest) (*ipam.RequestPoolResponse, error)
- type L2TPCleaner
- type L2TPConfig
- type L2TPNetworkDriver
- func (s L2TPNetworkDriver) AddNetwork(netID string, netInfo *l2tpNetwork) error
- func (s L2TPNetworkDriver) AddNetworkAlias(netID, alias string) error
- func (d *L2TPNetworkDriver) AllocateNetwork(request *network.AllocateNetworkRequest) (*network.AllocateNetworkResponse, error)
- func (d *L2TPNetworkDriver) CreateEndpoint(request *network.CreateEndpointRequest) (*network.CreateEndpointResponse, error)
- func (d *L2TPNetworkDriver) CreateNetwork(request *network.CreateNetworkRequest) error
- func (d *L2TPNetworkDriver) DeleteEndpoint(request *network.DeleteEndpointRequest) error
- func (d *L2TPNetworkDriver) DeleteNetwork(request *network.DeleteNetworkRequest) error
- func (d *L2TPNetworkDriver) DiscoverDelete(request *network.DiscoveryNotification) error
- func (d *L2TPNetworkDriver) DiscoverNew(request *network.DiscoveryNotification) error
- func (d *L2TPNetworkDriver) EndpointInfo(request *network.InfoRequest) (*network.InfoResponse, error)
- func (d *L2TPNetworkDriver) FreeNetwork(request *network.FreeNetworkRequest) error
- func (d *L2TPNetworkDriver) GetCapabilities() (*network.CapabilitiesResponse, error)
- func (s L2TPNetworkDriver) GetNetwork(netID string) (*l2tpNetwork, error)
- func (d *L2TPNetworkDriver) Join(request *network.JoinRequest) (*network.JoinResponse, error)
- func (d *L2TPNetworkDriver) Leave(request *network.LeaveRequest) error
- func (d *L2TPNetworkDriver) ProgramExternalConnectivity(request *network.ProgramExternalConnectivityRequest) error
- func (s L2TPNetworkDriver) RemoveNetwork(netID string) error
- func (d *L2TPNetworkDriver) RevokeExternalConnectivity(request *network.RevokeExternalConnectivityRequest) error
- type L2TPTuner
- func (t *L2TPTuner) GenerateInvitation(ID string) (*structs.NetworkSpec, error)
- func (t *L2TPTuner) GetCleaner(ctx context.Context, ID string) (Cleanup, error)
- func (t *L2TPTuner) Run(ctx context.Context) error
- func (t *L2TPTuner) Tune(ctx context.Context, net *structs.NetworkSpec, hostCfg *container.HostConfig, ...) (Cleanup, error)
- func (t *L2TPTuner) Tuned(ID string) bool
- type Network
- type NetworkAliasAction
- type NetworkManager
- func (m *NetworkManager) Close() error
- func (m *NetworkManager) CreateNetwork(ctx context.Context, request *CreateNetworkRequest) (*Network, error)
- func (m *NetworkManager) Prune(ctx context.Context, request *PruneRequest) (*PruneReply, error)
- func (m *NetworkManager) RemoveNetwork(network *Network) error
- type NetworkManagerConfig
- type PruneReply
- type PruneRequest
- type TBFShapingAction
- type TincCleaner
- type TincIPAMDriver
- func (t *TincIPAMDriver) GetCapabilities() (*ipam.CapabilitiesResponse, error)
- func (t *TincIPAMDriver) GetDefaultAddressSpaces() (*ipam.AddressSpacesResponse, error)
- func (t *TincIPAMDriver) ReleaseAddress(request *ipam.ReleaseAddressRequest) error
- func (t *TincIPAMDriver) ReleasePool(request *ipam.ReleasePoolRequest) error
- func (t *TincIPAMDriver) RequestAddress(request *ipam.RequestAddressRequest) (*ipam.RequestAddressResponse, error)
- func (t *TincIPAMDriver) RequestPool(request *ipam.RequestPoolRequest) (*ipam.RequestPoolResponse, error)
- type TincNetwork
- func (t *TincNetwork) Init(ctx context.Context) error
- func (t *TincNetwork) Invite(ctx context.Context, inviteeID string) (string, error)
- func (t *TincNetwork) Join(ctx context.Context) error
- func (t *TincNetwork) OccupiedIPs(ctx context.Context) (map[IP4]struct{}, error)
- func (t *TincNetwork) Shutdown(ctx context.Context) error
- func (t *TincNetwork) Start(ctx context.Context, addr string) error
- func (t *TincNetwork) Stop(ctx context.Context) error
- type TincNetworkConfig
- type TincNetworkDriver
- func (t *TincNetworkDriver) AllocateNetwork(request *network.AllocateNetworkRequest) (*network.AllocateNetworkResponse, error)
- func (t *TincNetworkDriver) CreateEndpoint(request *network.CreateEndpointRequest) (*network.CreateEndpointResponse, error)
- func (t *TincNetworkDriver) CreateNetwork(request *network.CreateNetworkRequest) error
- func (t *TincNetworkDriver) DeleteEndpoint(request *network.DeleteEndpointRequest) error
- func (t *TincNetworkDriver) DeleteNetwork(request *network.DeleteNetworkRequest) error
- func (t *TincNetworkDriver) DiscoverDelete(request *network.DiscoveryNotification) error
- func (t *TincNetworkDriver) DiscoverNew(request *network.DiscoveryNotification) error
- func (t *TincNetworkDriver) EndpointInfo(request *network.InfoRequest) (*network.InfoResponse, error)
- func (t *TincNetworkDriver) FreeNetwork(request *network.FreeNetworkRequest) error
- func (t *TincNetworkDriver) GenerateInvitation(NodeID string) (*structs.NetworkSpec, error)
- func (t *TincNetworkDriver) GetCapabilities() (*network.CapabilitiesResponse, error)
- func (t *TincNetworkDriver) HasNetwork(NodeID string) bool
- func (t *TincNetworkDriver) Join(request *network.JoinRequest) (*network.JoinResponse, error)
- func (t *TincNetworkDriver) Leave(request *network.LeaveRequest) error
- func (t *TincNetworkDriver) ProgramExternalConnectivity(request *network.ProgramExternalConnectivityRequest) error
- func (t *TincNetworkDriver) RevokeExternalConnectivity(request *network.RevokeExternalConnectivityRequest) error
- type TincNetworkState
- type TincTuner
- type Tuner
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewL2TPEndpoint ¶
func NewL2TPEndpoint(netInfo *l2tpNetwork) *l2tpEndpoint
func NewTinc ¶
func NewTinc(ctx context.Context, client *client.Client, config *TincNetworkConfig) (*TincNetworkDriver, *TincIPAMDriver, error)
Types ¶
type Action ¶ added in v0.4.9
type Action interface { // Execute executes this action, returning error if any. Execute(ctx context.Context) error // Rollback rollbacks this action, returning error if any. Rollback() error }
Action is an abstraction of some action that can be rolled back.
type ActionQueue ¶ added in v0.4.9
type ActionQueue struct {
// contains filtered or unexported fields
}
ActionQueue represents a queue of executable actions. Any action that fails triggers cascade previous actions rollback.
func NewActionQueue ¶ added in v0.4.9
func NewActionQueue(actions ...Action) *ActionQueue
func (*ActionQueue) Execute ¶ added in v0.4.9
Execute executes the given action.
If that action fails a cascade previous actions rollback occurs resulting in a tuple of this's action error and rollback ones if any.
func (*ActionQueue) Rollback ¶ added in v0.4.9
func (m *ActionQueue) Rollback() error
type CreateNetworkRequest ¶ added in v0.4.9
type DockerNetworkCreateAction ¶ added in v0.4.9
func (*DockerNetworkCreateAction) Execute ¶ added in v0.4.9
func (m *DockerNetworkCreateAction) Execute(ctx context.Context) error
func (*DockerNetworkCreateAction) Rollback ¶ added in v0.4.9
func (m *DockerNetworkCreateAction) Rollback() error
type HTBShapingAction ¶ added in v0.4.9
type HTBShapingAction struct { Network *Network // contains filtered or unexported fields }
func (*HTBShapingAction) Execute ¶ added in v0.4.9
func (m *HTBShapingAction) Execute(ctx context.Context) error
func (*HTBShapingAction) Rollback ¶ added in v0.4.9
func (m *HTBShapingAction) Rollback() error
type IP4 ¶
type IP4 struct {
// contains filtered or unexported fields
}
A comparable type for v4 address
type IPAMDriver ¶
type IPAMDriver struct {
// contains filtered or unexported fields
}
func NewIPAMDriver ¶
func NewIPAMDriver(ctx context.Context, state *l2tpState) *IPAMDriver
func (IPAMDriver) AddNetwork ¶
func (IPAMDriver) AddNetworkAlias ¶
func (*IPAMDriver) GetCapabilities ¶
func (d *IPAMDriver) GetCapabilities() (*ipam.CapabilitiesResponse, error)
func (*IPAMDriver) GetDefaultAddressSpaces ¶
func (d *IPAMDriver) GetDefaultAddressSpaces() (*ipam.AddressSpacesResponse, error)
func (IPAMDriver) GetNetwork ¶
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 (*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 (L2TPNetworkDriver) AddNetworkAlias ¶
func (*L2TPNetworkDriver) AllocateNetwork ¶
func (d *L2TPNetworkDriver) AllocateNetwork(request *network.AllocateNetworkRequest) (*network.AllocateNetworkResponse, error)
func (*L2TPNetworkDriver) CreateEndpoint ¶
func (d *L2TPNetworkDriver) CreateEndpoint(request *network.CreateEndpointRequest) (*network.CreateEndpointResponse, error)
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 (*L2TPNetworkDriver) Join ¶
func (d *L2TPNetworkDriver) Join(request *network.JoinRequest) (*network.JoinResponse, error)
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 (*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 (*L2TPTuner) Tune ¶
func (t *L2TPTuner) Tune(ctx context.Context, net *structs.NetworkSpec, hostCfg *container.HostConfig, netCfg *network.NetworkingConfig) (Cleanup, error)
type NetworkAliasAction ¶ added in v0.4.9
type NetworkAliasAction struct {
Network *Network
}
NetworkAliasAction represents an action that is capable of creating an alias to the created bridge network.
Must be appended just after creating Docker network.
func (*NetworkAliasAction) Execute ¶ added in v0.4.9
func (m *NetworkAliasAction) Execute(ctx context.Context) error
func (*NetworkAliasAction) Rollback ¶ added in v0.4.9
func (m *NetworkAliasAction) Rollback() error
type NetworkManager ¶ added in v0.4.9
type NetworkManager struct {
// contains filtered or unexported fields
}
func NewNetworkManager ¶ added in v0.4.9
func NewNetworkManager() (*NetworkManager, error)
NewNetworkManager constructs a new network manager.
Some basic checks are performed during execution of this function, like checking whether the host OS is capable to limit network bandwidth etc.
func NewNetworkManagerWithConfig ¶ added in v0.4.9
func NewNetworkManagerWithConfig(cfg NetworkManagerConfig) (*NetworkManager, error)
func (*NetworkManager) Close ¶ added in v0.4.9
func (m *NetworkManager) Close() error
func (*NetworkManager) CreateNetwork ¶ added in v0.4.9
func (m *NetworkManager) CreateNetwork(ctx context.Context, request *CreateNetworkRequest) (*Network, error)
func (*NetworkManager) Prune ¶ added in v0.4.9
func (m *NetworkManager) Prune(ctx context.Context, request *PruneRequest) (*PruneReply, error)
Prune tries to remove all unused networks that look like a SONM networks.
We attach a special tag to Docker networks, so we can identify a network created by us from others.
func (*NetworkManager) RemoveNetwork ¶ added in v0.4.9
func (m *NetworkManager) RemoveNetwork(network *Network) error
type NetworkManagerConfig ¶ added in v0.4.9
type NetworkManagerConfig struct { DockerClient *client.Client Log *zap.SugaredLogger }
type PruneReply ¶ added in v0.4.9
type PruneRequest ¶ added in v0.4.9
type PruneRequest struct { // IDs specify network interface suffixes. IDs []string }
type TBFShapingAction ¶ added in v0.4.9
type TBFShapingAction struct { Network *Network // contains filtered or unexported fields }
func (*TBFShapingAction) Execute ¶ added in v0.4.9
func (m *TBFShapingAction) Execute(ctx context.Context) error
func (*TBFShapingAction) Rollback ¶ added in v0.4.9
func (m *TBFShapingAction) Rollback() error
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 (t *TincIPAMDriver) RequestAddress(request *ipam.RequestAddressRequest) (*ipam.RequestAddressResponse, error)
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) OccupiedIPs ¶
func (t *TincNetwork) OccupiedIPs(ctx context.Context) (map[IP4]struct{}, 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 (t *TincNetworkDriver) AllocateNetwork(request *network.AllocateNetworkRequest) (*network.AllocateNetworkResponse, error)
func (*TincNetworkDriver) CreateEndpoint ¶
func (t *TincNetworkDriver) CreateEndpoint(request *network.CreateEndpointRequest) (*network.CreateEndpointResponse, error)
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 (t *TincNetworkDriver) Join(request *network.JoinRequest) (*network.JoinResponse, error)
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 (*TincTuner) Tune ¶
func (t *TincTuner) Tune(ctx context.Context, net *structs.NetworkSpec, hostConfig *container.HostConfig, config *network.NetworkingConfig) (Cleanup, error)
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.