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 wgkey.Private 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 ¶
PeerWithKey returns the Peer with key k and reports whether it was found.
type Endpoints ¶ added in v1.10.0
type Endpoints struct { // PublicKey is the public key for the remote node. PublicKey wgkey.Key `json:"pk"` // DiscoKey is the disco key associated with the remote node. DiscoKey tailcfg.DiscoKey `json:"dk,omitempty"` // IPPorts is a set of possible ip+ports the remote node can be reached at. // This is used only for legacy connections to pre-disco (pre-0.100) peers. IPPorts IPPortSet `json:"ipp,omitempty"` }
Endpoints represents the routes to reach a remote node. It is serialized and provided to wireguard-go as a conn.Endpoint.
type IPPortSet ¶ added in v1.10.0
type IPPortSet struct {
// contains filtered or unexported fields
}
IPPortSet is an immutable slice of netaddr.IPPorts.
func NewIPPortSet ¶ added in v1.10.0
NewIPPortSet returns an IPPortSet containing the ports in ipp.
func (*IPPortSet) Clone ¶ added in v1.10.0
Clone makes a deep copy of IPPortSet. The result aliases no memory with the original.
func (IPPortSet) EqualUnordered ¶ added in v1.10.0
EqualUnordered reports whether s and t contain the same IPPorts, regardless of order.
func (IPPortSet) IPPorts ¶ added in v1.10.0
IPPorts returns a slice of netaddr.IPPorts containing the IPPorts in s.
func (IPPortSet) MarshalJSON ¶ added in v1.10.0
MarshalJSON marshals s into JSON. It is necessary so that IPPortSet's fields can be unexported, to guarantee immutability.
func (IPPortSet) String ¶ added in v1.10.0
String returns a comma-separated list of all IPPorts in s.
func (*IPPortSet) UnmarshalJSON ¶ added in v1.10.0
UnmarshalJSON unmarshals s from JSON. It is necessary so that IPPortSet's fields can be unexported, to guarantee immutability.
type ParseError ¶
type ParseError struct {
// contains filtered or unexported fields
}
func (*ParseError) Error ¶
func (e *ParseError) Error() string