types

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Type           = 1
	ConfigFileName = "wireguard.toml"
)
View Source
const (
	KeyLength = 32
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Interface  string `json:"interface" mapstructure:"interface"`
	ListenPort uint16 `json:"listen_port" mapstructure:"listen_port"`
	PrivateKey string `json:"private_key" mapstructure:"private_key"`
}

func NewConfig

func NewConfig() *Config

func ReadInConfig

func ReadInConfig(v *viper.Viper) (*Config, error)

func (*Config) SaveToPath

func (c *Config) SaveToPath(path string) error

func (*Config) String

func (c *Config) String() string

func (*Config) Validate

func (c *Config) Validate() error

func (*Config) WithDefaultValues

func (c *Config) WithDefaultValues() *Config

type IPPool

type IPPool struct {
	V4 *IPv4Pool
	V6 *IPv6Pool
}

func NewIPPool

func NewIPPool(v4 *IPv4Pool, v6 *IPv6Pool) *IPPool

func (*IPPool) Get

func (p *IPPool) Get() (IPv4, IPv6, error)

func (*IPPool) Release

func (p *IPPool) Release(v4 IPv4, v6 IPv6)

type IPv4

type IPv4 [net.IPv4len]byte

func NewIPv4FromIP

func NewIPv4FromIP(ip net.IP) (v4 IPv4)

func (IPv4) Bytes

func (ip IPv4) Bytes() []byte

func (IPv4) Empty

func (ip IPv4) Empty() bool

func (IPv4) IP

func (ip IPv4) IP() net.IP

func (IPv4) Next

func (ip IPv4) Next() IPv4

type IPv4Pool

type IPv4Pool struct {
	Net *net.IPNet
	// contains filtered or unexported fields
}

func NewIPv4Pool

func NewIPv4Pool(ip net.IP, ipNet *net.IPNet) *IPv4Pool

func NewIPv4PoolFromCIDR

func NewIPv4PoolFromCIDR(s string) (*IPv4Pool, error)

func (*IPv4Pool) Get

func (p *IPv4Pool) Get() (ip IPv4, err error)

func (*IPv4Pool) Release

func (p *IPv4Pool) Release(ip IPv4)

type IPv6

type IPv6 [net.IPv6len]byte

func NewIPv6FromIP

func NewIPv6FromIP(ip net.IP) (v6 IPv6)

func (IPv6) Bytes

func (ip IPv6) Bytes() []byte

func (IPv6) Empty

func (ip IPv6) Empty() bool

func (IPv6) IP

func (ip IPv6) IP() net.IP

func (IPv6) Next

func (ip IPv6) Next() IPv6

type IPv6Pool

type IPv6Pool struct {
	Net *net.IPNet
	// contains filtered or unexported fields
}

func NewIPv6Pool

func NewIPv6Pool(ip net.IP, ipNet *net.IPNet) *IPv6Pool

func NewIPv6PoolFromCIDR

func NewIPv6PoolFromCIDR(s string) (*IPv6Pool, error)

func (*IPv6Pool) Get

func (p *IPv6Pool) Get() (ip IPv6, err error)

func (*IPv6Pool) Release

func (p *IPv6Pool) Release(ip IPv6)

type Key

type Key [KeyLength]byte

func KeyFromBytes

func KeyFromBytes(b []byte) (*Key, error)

func KeyFromString

func KeyFromString(s string) (*Key, error)

func NewPreSharedKey

func NewPreSharedKey() (*Key, error)

func NewPrivateKey

func NewPrivateKey() (*Key, error)

func (*Key) Bytes

func (k *Key) Bytes() []byte

func (*Key) IsZero

func (k *Key) IsZero() bool

func (*Key) Public

func (k *Key) Public() *Key

func (*Key) String

func (k *Key) String() string

type Peer

type Peer struct {
	Identity string
	IPv4     IPv4
	IPv6     IPv6
}

func (Peer) Empty added in v0.1.2

func (p Peer) Empty() bool

type Peers

type Peers struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewPeers

func NewPeers() *Peers

func (*Peers) Delete

func (p *Peers) Delete(v string)

func (*Peers) Get

func (p *Peers) Get(key string) Peer

func (*Peers) Len

func (p *Peers) Len() int

func (*Peers) Put

func (p *Peers) Put(v Peer)

Jump to

Keyboard shortcuts

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