mirror of
https://github.com/tailscale/tailscale.git
synced 2025-10-27 20:19:31 +00:00
net/tstun: rename statististics method (#5852)
Rename StatisticsEnable as SetStatisticsEnabled to be consistent with other similarly named methods. Rename StatisticsExtract as ExtractStatistics to follow the convention where methods start with a verb. It was originally named with Statistics as a prefix so that statistics related methods would sort well in godoc, but that property no longer holds. Signed-off-by: Joe Tsai <joetsai@digital-static.net>
This commit is contained in:
@@ -843,15 +843,15 @@ func (t *Wrapper) Unwrap() tun.Device {
|
||||
return t.tdev
|
||||
}
|
||||
|
||||
// StatisticsEnable enables per-connections packet counters.
|
||||
// StatisticsExtract must be called periodically to avoid unbounded memory use.
|
||||
func (t *Wrapper) StatisticsEnable(enable bool) {
|
||||
// SetStatisticsEnabled enables per-connections packet counters.
|
||||
// ExtractStatistics must be called periodically to avoid unbounded memory use.
|
||||
func (t *Wrapper) SetStatisticsEnabled(enable bool) {
|
||||
t.stats.enabled.Store(enable)
|
||||
}
|
||||
|
||||
// StatisticsExtract extracts and resets the counters for all active connections.
|
||||
// ExtractStatistics extracts and resets the counters for all active connections.
|
||||
// It must be called periodically otherwise the memory used is unbounded.
|
||||
func (t *Wrapper) StatisticsExtract() map[flowtrack.Tuple]tunstats.Counts {
|
||||
func (t *Wrapper) ExtractStatistics() map[flowtrack.Tuple]tunstats.Counts {
|
||||
return t.stats.Extract()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user