(err error)
| 101 | } |
| 102 | |
| 103 | func (wg *WireGuard) logStatsDeviceReadError(err error) { |
| 104 | now := time.Now() |
| 105 | |
| 106 | wg.mu.Lock() |
| 107 | if !wg.lastStatsErrAt.IsZero() && now.Sub(wg.lastStatsErrAt) < statsDeviceErrorLogInterval { |
| 108 | wg.mu.Unlock() |
| 109 | return |
| 110 | } |
| 111 | wg.lastStatsErrAt = now |
| 112 | wg.mu.Unlock() |
| 113 | |
| 114 | log.Printf("wireguard stats update skipped: failed to read device: %v", err) |
| 115 | wg.emitWarningLogf("wireguard stats update skipped: failed to read device: %v", err) |
| 116 | } |
| 117 | |
| 118 | // cleanupOfflineUsers removes deleted stats entries once their traffic has been reported. |
| 119 | func (wg *WireGuard) cleanupOfflineUsers(ctx context.Context) { |
no test coverage detected