wglog

package
v1.102.0 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2026 License: BSD-3-Clause Imports: 7 Imported by: 3

Documentation

Overview

Package wglog contains logging helpers for wireguard-go.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Logger

type Logger struct {
	DeviceLogger *device.Logger
	// contains filtered or unexported fields
}

A Logger is a wireguard-go log wrapper that cleans up and rewrites log lines. It rewrites wireguard-go peer references like "peer(XXXX…YYYY)" into the Tailscale-conventional short string form like "[XXXXX]".

func NewLogger

func NewLogger(logf logger.Logf, lookup func(wgString string) (tsString string, ok bool)) *Logger

NewLogger creates a new logger for use with wireguard-go. This logger silences repetitive/unhelpful noisy log lines and rewrites peer keys from wireguard-go into Tailscale format.

lookup, if non-nil, is consulted on cache misses to translate wireguard-go peer references in log lines. If lookup is nil, peer references are passed through unchanged.

func (*Logger) Invalidate added in v1.102.0

func (x *Logger) Invalidate()

Invalidate clears the peer-string rewrite cache.

Callers should invoke Invalidate when the set of wireguard-go peers has changed so that the next log line re-resolves peer references against the current lookup. It is safe to call concurrently with logging.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL