subnet

package
v0.25.5 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckNetworkConfig

func CheckNetworkConfig(config *Config) error

CheckNetworkConfig checks the coherence of the flannel configuration. It is used only with the local network manager, not with the kubernetes-based manager.

func MakeSubnetKey

func MakeSubnetKey(sn ip.IP4Net, sn6 ip.IP6Net) string

func ParseSubnetKey

func ParseSubnetKey(s string) (*ip.IP4Net, *ip.IP6Net)

func WatchLease

func WatchLease(ctx context.Context, sm Manager, sn ip.IP4Net, sn6 ip.IP6Net, receiver chan lease.Event)

WatchLease performs a long term watch of the given network's subnet lease and communicates addition/deletion events on receiver channel. It takes care of handling "fall-behind" logic where the history window has advanced too far and it needs to diff the latest snapshot with its saved state and generate events

func WatchLeases

func WatchLeases(ctx context.Context, sm Manager, ownLease *lease.Lease, receiver chan []lease.Event)

WatchLeases performs a long term watch of the given network's subnet leases and communicates addition/deletion events on receiver channel. It takes care of handling "fall-behind" logic where the history window has advanced too far and it needs to diff the latest snapshot with its saved state and generate events

func WriteSubnetFile

func WriteSubnetFile(path string, config *Config, ipMasq bool, sn ip.IP4Net, ipv6sn ip.IP6Net, mtu int) error

Types

type Config

type Config struct {
	EnableIPv4     bool
	EnableIPv6     bool
	EnableNFTables bool
	Network        ip.IP4Net
	IPv6Network    ip.IP6Net
	SubnetMin      ip.IP4
	SubnetMax      ip.IP4
	IPv6SubnetMin  *ip.IP6
	IPv6SubnetMax  *ip.IP6
	SubnetLen      uint
	IPv6SubnetLen  uint
	BackendType    string          `json:"-"`
	Backend        json.RawMessage `json:",omitempty"`
}

func ParseConfig

func ParseConfig(s string) (*Config, error)

type Manager

type Manager interface {
	GetNetworkConfig(ctx context.Context) (*Config, error)
	HandleSubnetFile(path string, config *Config, ipMasq bool, sn ip.IP4Net, ipv6sn ip.IP6Net, mtu int) error
	AcquireLease(ctx context.Context, attrs *lease.LeaseAttrs) (*lease.Lease, error)
	RenewLease(ctx context.Context, lease *lease.Lease) error
	WatchLease(ctx context.Context, sn ip.IP4Net, sn6 ip.IP6Net, receiver chan []lease.LeaseWatchResult) error
	WatchLeases(ctx context.Context, receiver chan []lease.LeaseWatchResult) error
	CompleteLease(ctx context.Context, lease *lease.Lease, wg *sync.WaitGroup) error

	GetStoredMacAddresses(ctx context.Context) (string, string)
	GetStoredPublicIP(ctx context.Context) (string, string)
	Name() string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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