MCPcopy Create free account
hub / github.com/PasarGuard/node / WireGuard

Struct WireGuard

backend/wireguard/wireguard.go:42–68  ·  view source on GitHub ↗

WireGuard locking hierarchy — must always be acquired in this order: wg.syncMu serialises all peer sync/remove operations wg.mu guards lifecycle state (manager, state, config, version) m.mu guards Manager internals (client, configure, nl) Never acquire an outer lock while holding an

Source from the content-addressed store, hash-verified

40//
41// Never acquire an outer lock while holding an inner one.
42type WireGuard struct {
43 config *Config
44 cfg *config.Config
45 manager *Manager
46 statsTracker *stats.Tracker
47 peerStore *PeerStore
48
49 // Tickers
50 updateTicker *time.Ticker
51 cleanupTicker *time.Ticker
52
53 // Stats update config
54 updateInterval time.Duration
55
56 logChan chan string
57 cancelFunc context.CancelFunc
58 startTime time.Time
59 version string
60 mu sync.RWMutex
61 state lifecycleState
62 interfaceStats *stats.InterfaceCountersTracker
63 shutdownOnce sync.Once
64 syncMu sync.Mutex
65 lastStatsErrAt time.Time
66 newManager newManagerFunc
67 hostRouting func()
68}
69
70// getWireGuardVersion fetches the wireguard-tools version
71func getWireGuardVersion() string {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected