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

Method handleInterfaceOutboundStats

backend/wireguard/stats.go:44–58  ·  view source on GitHub ↗
(name string, reset bool)

Source from the content-addressed store, hash-verified

42}
43
44func (wg *WireGuard) handleInterfaceOutboundStats(name string, reset bool) (*common.StatResponse, error) {
45 if name == "" {
46 name = wg.config.InterfaceName
47 }
48
49 currentRx, currentTx, err := wg.getInterfaceCounters()
50 if err != nil {
51 return nil, err
52 }
53
54 deltaRx, deltaTx := wg.interfaceStats.Delta(currentRx, currentTx, reset)
55 return &common.StatResponse{
56 Stats: stats.BuildInterfaceStats(name, "interface", deltaRx, deltaTx),
57 }, nil
58}
59
60func (wg *WireGuard) GetStats(ctx context.Context, request *common.StatRequest) (*common.StatResponse, error) {
61 wg.mu.RLock()

Callers 1

GetStatsMethod · 0.95

Calls 3

getInterfaceCountersMethod · 0.95
BuildInterfaceStatsFunction · 0.92
DeltaMethod · 0.80

Tested by

no test coverage detected