types

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultInterface = "wg99"
)
View Source
const (
	KeyLength = 32
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Name      string    `json:"name"`
	Interface Interface `json:"-"`
	Peers     []Peer    `json:"-"`
}

func (*Config) ToWgQuick

func (c *Config) ToWgQuick() string

func (*Config) WriteToFile

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

type Endpoint

type Endpoint struct {
	Host string
	Port uint16
}

func (*Endpoint) IsEmpty

func (e *Endpoint) IsEmpty() bool

func (*Endpoint) String

func (e *Endpoint) String() string

type IPNet

type IPNet struct {
	IP  net.IP
	Net uint8
}

func (*IPNet) String

func (r *IPNet) String() string

type Interface

type Interface struct {
	PrivateKey Key      `json:"-"`
	Addresses  []IPNet  `json:"-"`
	ListenPort uint16   `json:"-"`
	MTU        uint16   `json:"-"`
	DNS        []net.IP `json:"-"`
	DNSSearch  []string `json:"-"`
	PreUp      string   `json:"-"`
	PostUp     string   `json:"-"`
	PreDown    string   `json:"-"`
	PostDown   string   `json:"-"`
}

type Key

type Key [KeyLength]byte

func NewKey

func NewKey(v []byte) *Key

func NewPresharedKey

func NewPresharedKey() (*Key, error)

func NewPrivateKey

func NewPrivateKey() (*Key, error)

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 {
	PublicKey           Key      `json:"-"`
	PresharedKey        Key      `json:"-"`
	AllowedIPs          []IPNet  `json:"-"`
	Endpoint            Endpoint `json:"-"`
	PersistentKeepalive uint16   `json:"-"`
}

Jump to

Keyboard shortcuts

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