Documentation ¶
Index ¶
- func NewServerCollector() *serverCollector
- type Collector
- type Config
- type NoopCollector
- func (NoopCollector) CollectTCPSession(username string, downlinkBytes, uplinkBytes uint64)
- func (NoopCollector) CollectUDPSessionDownlink(username string, downlinkPackets, downlinkBytes uint64)
- func (NoopCollector) CollectUDPSessionUplink(username string, uplinkPackets, uplinkBytes uint64)
- func (NoopCollector) Snapshot() Server
- func (NoopCollector) SnapshotAndReset() Server
- type Server
- type Traffic
- type User
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewServerCollector ¶
func NewServerCollector() *serverCollector
NewServerCollector returns a new collector for collecting server traffic statistics.
Types ¶
type Collector ¶
type Collector interface { // CollectTCPSession collects the TCP session's traffic statistics. CollectTCPSession(username string, downlinkBytes, uplinkBytes uint64) // CollectUDPSessionDownlink collects the UDP session's downlink traffic statistics. CollectUDPSessionDownlink(username string, downlinkPackets, downlinkBytes uint64) // CollectUDPSessionUplink collects the UDP session's uplink traffic statistics. CollectUDPSessionUplink(username string, uplinkPackets, uplinkBytes uint64) // Snapshot returns the server's traffic statistics. Snapshot() Server // SnapshotAndReset returns the server's traffic statistics and resets the statistics. SnapshotAndReset() Server }
Collector collects server traffic statistics.
type Config ¶
type Config struct {
Enabled bool `json:"enabled"`
}
Config stores configuration for the stats collector.
type NoopCollector ¶
type NoopCollector struct{}
NoopCollector is a no-op collector. Its collect methods do nothing and its snapshot method returns empty statistics.
func (NoopCollector) CollectTCPSession ¶
func (NoopCollector) CollectTCPSession(username string, downlinkBytes, uplinkBytes uint64)
CollectTCPSession implements the Collector CollectTCPSession method.
func (NoopCollector) CollectUDPSessionDownlink ¶
func (NoopCollector) CollectUDPSessionDownlink(username string, downlinkPackets, downlinkBytes uint64)
CollectUDPSessionDownlink implements the Collector CollectUDPSessionDownlink method.
func (NoopCollector) CollectUDPSessionUplink ¶
func (NoopCollector) CollectUDPSessionUplink(username string, uplinkPackets, uplinkBytes uint64)
CollectUDPSessionUplink implements the Collector CollectUDPSessionUplink method.
func (NoopCollector) Snapshot ¶
func (NoopCollector) Snapshot() Server
Snapshot implements the Collector Snapshot method.
func (NoopCollector) SnapshotAndReset ¶
func (NoopCollector) SnapshotAndReset() Server
SnapshotAndReset implements the Collector SnapshotAndReset method.
type Traffic ¶
type Traffic struct { DownlinkPackets uint64 `json:"downlinkPackets"` DownlinkBytes uint64 `json:"downlinkBytes"` UplinkPackets uint64 `json:"uplinkPackets"` UplinkBytes uint64 `json:"uplinkBytes"` TCPSessions uint64 `json:"tcpSessions"` UDPSessions uint64 `json:"udpSessions"` }
Traffic stores the traffic statistics.