Movatterモバイル変換


[0]ホーム

URL:


wgcfg

package
v1.92.2Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2025 License:BSD-3-ClauseImports:18Imported by:20

Details

Repository

github.com/tailscale/tailscale

Links

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

funcNewDeviceadded inv1.18.0

func NewDevice(tunDevtun.Device, bindconn.Bind, logger *device.Logger) *device.Device

NewDevice returns a wireguard-go Device configured for Tailscale use.

funcReconfigDevice

func ReconfigDevice(d *device.Device, cfg *Config, logflogger.Logf) (errerror)

ReconfigDevice replaces the existing device configuration with cfg.

Types

typeConfig

type Config struct {PrivateKeykey.NodePrivateAddresses  []netip.PrefixMTUuint16DNS        []netip.AddrPeers      []Peer// NetworkLogging enables network logging.// It is disabled if either ID is the zero value.// LogExitFlowEnabled indicates whether or not exit flows should be logged.NetworkLogging struct {NodeIDlogid.PrivateIDDomainIDlogid.PrivateIDLogExitFlowEnabledbool}}

Config is a WireGuard configuration.It only supports the set of things Tailscale uses.

funcDeviceConfig

func DeviceConfig(d *device.Device) (*Config,error)

funcFromUAPI

func FromUAPI(rio.Reader) (*Config,error)

FromUAPI generates a Config from r.r should be generated by calling device.IpcGetOperation;it is not compatible with other uapi streams.

func (*Config)Cloneadded inv1.10.0

func (src *Config) Clone() *Config

Clone makes a deep copy of Config.The result aliases no memory with the original.

func (*Config)Equaladded inv1.90.0

func (c *Config) Equal(o *Config)bool

func (Config)PeerWithKey

func (configConfig) PeerWithKey(kkey.NodePublic) (Peer,bool)

PeerWithKey returns the Peer with key k and reports whether it was found.

func (*Config)ToUAPI

func (cfg *Config) ToUAPI(logflogger.Logf, wio.Writer, prev *Config)error

ToUAPI writes cfg in UAPI format to w.Prev is the previous device Config.

Prev is required so that we can remove now-defunct peers without having toremove and re-add all peers, and so that we can avoid writing informationabout peers that have not changed since the previous time we wrote ourConfig.

typeParseError

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

func (*ParseError)Error

func (e *ParseError) Error()string

typePeer

type Peer struct {PublicKeykey.NodePublicDiscoKeykey.DiscoPublic// present only so we can handle restarts within wgengine, not passed to WireGuardAllowedIPs          []netip.PrefixV4MasqAddr          *netip.Addr// if non-nil, masquerade IPv4 traffic to this peer using this addressV6MasqAddr          *netip.Addr// if non-nil, masquerade IPv6 traffic to this peer using this addressIsJailedbool// if true, this peer is jailed and cannot initiate connectionsPersistentKeepaliveuint16// in seconds between keep-alives; 0 to disable// 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.WGEndpointkey.NodePublic}

func (*Peer)Cloneadded inv1.10.0

func (src *Peer) Clone() *Peer

Clone makes a deep copy of Peer.The result aliases no memory with the original.

func (Peer)Equaladded inv1.90.0

func (pPeer) Equal(oPeer)bool

Source Files

View all Source files

Directories

PathSynopsis
Package nmcfg converts a controlclient.NetMap into a wgcfg config.
Package nmcfg converts a controlclient.NetMap into a wgcfg config.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f orF : Jump to
y orY : Canonical URL
go.dev uses cookies from Google to deliver and enhance the quality of its services and to analyze traffic.Learn more.

[8]ページ先頭

©2009-2025 Movatter.jp