conf

package
v0.0.0-...-1ce0ccd Latest Latest
Warning

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

Go to latest
Published: May 31, 2019 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const KeyLength = 32

Variables

This section is empty.

Functions

func DeleteName

func DeleteName(name string) error

func ListConfigNames

func ListConfigNames() ([]string, error)

func MigrateUnencryptedConfigs

func MigrateUnencryptedConfigs() (int, []error)

func NameFromPath

func NameFromPath(path string) (string, error)

func TunnelNameIsLess

func TunnelNameIsLess(a, b string) bool

func TunnelNameIsValid

func TunnelNameIsValid(name string) bool

Types

type Bytes

type Bytes uint64

func (Bytes) String

func (b Bytes) String() string

type Config

type Config struct {
	Name      string
	Interface Interface
	Peers     []Peer
}

func FromUAPI

func FromUAPI(s string, existingConfig *Config) (*Config, error)

func FromWgQuick

func FromWgQuick(s string, name string) (*Config, error)

func FromWgQuickWithUnknownEncoding

func FromWgQuickWithUnknownEncoding(s string, name string) (*Config, error)

func LoadFromName

func LoadFromName(name string) (*Config, error)

func LoadFromPath

func LoadFromPath(path string) (*Config, error)

func (*Config) Delete

func (config *Config) Delete() error

func (*Config) Path

func (config *Config) Path() (string, error)

func (*Config) Save

func (config *Config) Save() error

func (*Config) ToUAPI

func (conf *Config) ToUAPI() (uapi string, dnsErr error)

func (*Config) ToWgQuick

func (conf *Config) ToWgQuick() string

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 HandshakeTime

type HandshakeTime time.Duration

func (HandshakeTime) IsEmpty

func (t HandshakeTime) IsEmpty() bool

func (HandshakeTime) String

func (t HandshakeTime) String() string

type IPCidr

type IPCidr struct {
	IP   net.IP
	Cidr uint8
}

func (*IPCidr) Bits

func (r *IPCidr) Bits() uint8

func (*IPCidr) IPNet

func (r *IPCidr) IPNet() net.IPNet

func (*IPCidr) String

func (r *IPCidr) String() string

type Interface

type Interface struct {
	PrivateKey Key
	Addresses  []IPCidr
	ListenPort uint16
	MTU        uint16
	DNS        []net.IP
}

type Key

type Key [KeyLength]byte

func NewPresharedKey

func NewPresharedKey() (*Key, error)

func NewPrivateKey

func NewPrivateKey() (*Key, error)

func NewPrivateKeyFromString

func NewPrivateKeyFromString(b64 string) (*Key, error)

func (*Key) HexString

func (k *Key) HexString() string

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 ParseError

type ParseError struct {
	// contains filtered or unexported fields
}

func (*ParseError) Error

func (e *ParseError) Error() string

type Peer

type Peer struct {
	PublicKey           Key
	PresharedKey        Key
	AllowedIPs          []IPCidr
	Endpoint            Endpoint
	PersistentKeepalive uint16

	RxBytes           Bytes
	TxBytes           Bytes
	LastHandshakeTime HandshakeTime
}

type StoreCallback

type StoreCallback struct {
	// contains filtered or unexported fields
}

func RegisterStoreChangeCallback

func RegisterStoreChangeCallback(cb func()) *StoreCallback

func (*StoreCallback) Unregister

func (cb *StoreCallback) Unregister()

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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