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 ¶
func NewDevice ¶ added in v1.18.0
NewDevice returns a wireguard-go Device configured for Tailscale use.
func NewPeerLookupFunc ¶ added in v1.102.0
func NewPeerLookupFunc(bind conn.Bind, logf logger.Logf, peerConfig func(device.NoisePublicKey) (PeerConfig, bool)) device.PeerLookupFunc
NewPeerLookupFunc returns a device.PeerLookupFunc that lazily creates peers using peerConfig as the source of each peer's allowed IPs and optional pre-shared key. The peer's endpoint is derived from its public key via bind.
Types ¶
type Config ¶
type Config struct {
PrivateKey key.NodePrivate
Addresses []netip.Prefix
}
Config is a WireGuard configuration. It only supports the set of things Tailscale uses.
Peers are not part of the config: wireguard-go learns the peer set and each peer's configuration from the live per-peer config source installed via tailscale.com/wgengine.Engine.SetPeerConfigFunc.
type PeerConfig ¶ added in v1.104.0
type PeerConfig struct {
// AllowedIPs is the set of prefixes the peer may originate traffic from.
AllowedIPs []netip.Prefix
// disables the pre-shared-key layer.
PresharedKey device.NoisePresharedKey
}
PeerConfig is the WireGuard configuration for one peer.