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
| 40 | // |
| 41 | // Never acquire an outer lock while holding an inner one. |
| 42 | type 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 |
| 71 | func getWireGuardVersion() string { |
nothing calls this directly
no outgoing calls
no test coverage detected