resources

package
v0.0.0-...-365054f Latest Latest
Warning

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

Go to latest
Published: May 16, 2024 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var MaxConnections = 256

MaxConnections sets the limit to the maximum number of wireguard connections.

Functions

This section is empty.

Types

type Allocator

type Allocator struct {
	Ifaces      map[int]struct{}
	IPAddresses map[int]struct{}
	// contains filtered or unexported fields
}

Allocator is mock wireguard resource handler. It will manage lists of network interfaces names, IP addresses and port for endpoints.

func NewAllocator

func NewAllocator(ports portSupplier, subnet net.IPNet) *Allocator

NewAllocator creates new resource pool for wireguard connection.

func (*Allocator) AbandonedInterfaces

func (a *Allocator) AbandonedInterfaces() ([]net.Interface, error)

AbandonedInterfaces returns a list of abandoned interfaces that exist in the system, but was not allocated by the Allocator.

func (*Allocator) AllocateIPNet

func (a *Allocator) AllocateIPNet() (net.IPNet, error)

AllocateIPNet provides available IP address for the wireguard connection.

func (*Allocator) AllocateInterface

func (a *Allocator) AllocateInterface() (string, error)

AllocateInterface provides available name for the wireguard network interface.

func (*Allocator) AllocatePort

func (a *Allocator) AllocatePort() (int, error)

AllocatePort provides available UDP port for the wireguard endpoint.

func (*Allocator) ReleaseIPNet

func (a *Allocator) ReleaseIPNet(ipnet net.IPNet) error

ReleaseIPNet releases IP address.

func (*Allocator) ReleaseInterface

func (a *Allocator) ReleaseInterface(iface string) error

ReleaseInterface releases name for the wireguard network interface.

Jump to

Keyboard shortcuts

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