Documentation ¶
Overview ¶
Package wgcfg has types and a parser for representing WireGuard config.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct { Name string PrivateKey key.NodePrivate Addresses []netaddr.IPPrefix MTU uint16 DNS []netaddr.IP Peers []Peer }
Config is a WireGuard configuration. It only supports the set of things Tailscale uses.
func FromUAPI ¶
FromUAPI generates a Config from r. r should be generated by calling device.IpcGetOperation; it is not compatible with other uapi streams.
func (*Config) Clone ¶ added in v1.10.0
Clone makes a deep copy of Config. The result aliases no memory with the original.
func (Config) PeerWithKey ¶
func (config Config) PeerWithKey(k key.NodePublic) (Peer, bool)
PeerWithKey returns the Peer with key k and reports whether it was found.
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.NodePublic DiscoKey key.DiscoPublic // present only so we can handle restarts within wgengine, not passed to WireGuard AllowedIPs []netaddr.IPPrefix PersistentKeepalive uint16 // wireguard-go's endpoint for this peer. It should always equal Peer.PublicKey. // We represent it explicitly so that we can detect if they diverge and recover. // There is no need to set WGEndpoint explicitly when constructing a Peer by hand. // It is only populated when reading Peers from wireguard-go. WGEndpoint key.NodePublic }
Click to show internal directories.
Click to hide internal directories.