conf

package
v0.0.0-...-ea9ab63 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2020 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const PrivateKeyLength = 32
View Source
const PublicKeyLength = 33

Variables

This section is empty.

Functions

func DeleteName

func DeleteName(name string) error

func ListConfigNames

func ListConfigNames() ([]string, error)

func MigrateUnencryptedConfigs

func MigrateUnencryptedConfigs()

func NameFromPath

func NameFromPath(path string) (string, error)

func PathIsEncrypted

func PathIsEncrypted(path string) bool

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) DeduplicateNetworkEntries

func (conf *Config) DeduplicateNetworkEntries()

func (*Config) Delete

func (config *Config) Delete() error

func (*Config) Path

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

func (*Config) Redact

func (conf *Config) Redact()

func (*Config) Save

func (config *Config) Save(overwrite bool) 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) MaskSelf

func (r *IPCidr) MaskSelf()

func (*IPCidr) String

func (r *IPCidr) String() string

type Interface

type Interface struct {
	PrivateKey PrivateKey
	Addresses  []IPCidr
	ListenPort uint16
	MTU        uint16
	DNS        []net.IP
	DNSSearch  []string
	PreUp      string
	PostUp     string
	PreDown    string
	PostDown   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           PublicKey
	PresharedKey        PrivateKey
	AllowedIPs          []IPCidr
	Endpoint            Endpoint
	PersistentKeepalive uint16

	RxBytes           Bytes
	TxBytes           Bytes
	LastHandshakeTime HandshakeTime
}

type PrivateKey

type PrivateKey [PrivateKeyLength]byte

func NewPresharedKey

func NewPresharedKey() (*PrivateKey, error)

func NewPrivateKey

func NewPrivateKey() (*PrivateKey, error)

func NewPrivateKeyFromString

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

func (*PrivateKey) HexString

func (k *PrivateKey) HexString() string

func (*PrivateKey) IsZero

func (k *PrivateKey) IsZero() bool

func (*PrivateKey) Public

func (k *PrivateKey) Public() *PublicKey

func (*PrivateKey) String

func (k *PrivateKey) String() string

type PublicKey

type PublicKey [PublicKeyLength]byte

func NewPublicKeyFromString

func NewPublicKeyFromString(b64 string) (*PublicKey, error)

func (*PublicKey) HexString

func (k *PublicKey) HexString() string

func (*PublicKey) IsZero

func (k *PublicKey) IsZero() bool

func (*PublicKey) String

func (k *PublicKey) String() string

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