mirror of https://github.com/tailscale/tailscale/
net/connstats: make it modular (omittable)
Saves only 12 KB, but notably removes some deps on packages that future changes can then eliminate entirely. Updates #12614 Change-Id: Ibf830d3ee08f621d0a2011b1d4cd175427ef50df Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>pull/17445/head
parent
2e381557b8
commit
3c7e351671
@ -0,0 +1,13 @@
|
||||
// Copyright (c) Tailscale Inc & AUTHORS
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
// Code generated by gen.go; DO NOT EDIT.
|
||||
|
||||
//go:build ts_omit_connstats
|
||||
|
||||
package buildfeatures
|
||||
|
||||
// HasConnStats is whether the binary was built with support for modular feature "Track per-packet connection statistics".
|
||||
// Specifically, it's whether the binary was NOT built with the "ts_omit_connstats" build tag.
|
||||
// It's a const so it can be used for dead code elimination.
|
||||
const HasConnStats = false
|
||||
@ -0,0 +1,13 @@
|
||||
// Copyright (c) Tailscale Inc & AUTHORS
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
// Code generated by gen.go; DO NOT EDIT.
|
||||
|
||||
//go:build !ts_omit_connstats
|
||||
|
||||
package buildfeatures
|
||||
|
||||
// HasConnStats is whether the binary was built with support for modular feature "Track per-packet connection statistics".
|
||||
// Specifically, it's whether the binary was NOT built with the "ts_omit_connstats" build tag.
|
||||
// It's a const so it can be used for dead code elimination.
|
||||
const HasConnStats = true
|
||||
@ -0,0 +1,24 @@
|
||||
// Copyright (c) Tailscale Inc & AUTHORS
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
//go:build ts_omit_connstats
|
||||
|
||||
package connstats
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/netip"
|
||||
"time"
|
||||
)
|
||||
|
||||
type Statistics struct{}
|
||||
|
||||
func NewStatistics(maxPeriod time.Duration, maxConns int, dump func(start, end time.Time, virtual, physical any)) *Statistics {
|
||||
return &Statistics{}
|
||||
}
|
||||
|
||||
func (s *Statistics) UpdateTxVirtual(b []byte) {}
|
||||
func (s *Statistics) UpdateRxVirtual(b []byte) {}
|
||||
func (s *Statistics) UpdateTxPhysical(src netip.Addr, dst netip.AddrPort, packets, bytes int) {}
|
||||
func (s *Statistics) UpdateRxPhysical(src netip.Addr, dst netip.AddrPort, packets, bytes int) {}
|
||||
func (s *Statistics) Shutdown(context.Context) error { return nil }
|
||||
Loading…
Reference in New Issue