Documentation
¶
Overview ¶
Package measured wraps a dialer/listener to measure the throughput on those connections. Throughput is represented as total bytes sent/received between each interval.
ID is the remote address by default.
A list of reporters can be plugged in to send the results to different target.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Conn ¶
type Conn struct {
net.Conn
// arbitrary string to identify this connection, defaults to remote address
ID string
// total bytes read from this connection
BytesIn uint64
// total bytes wrote to this connection
BytesOut uint64
// contains filtered or unexported fields
}
Conn wraps any net.Conn to add statistics
type Measured ¶
type Measured struct {
// contains filtered or unexported fields
}
Measured is the controller to report statistics
func (*Measured) Listener ¶
Listener wraps a listener to measure various statistics of each connection it accepts
type MeasuredListener ¶
type Reporter ¶
type Reporter interface {
ReportTraffic(map[string]*TrafficTracker) error
}
Reporter encapsulates different ways to report statistics
type TrafficTracker ¶
type TrafficTracker struct {
MinIn uint64
MaxIn uint64
// Temporarily disabling percentiles since we're not using them. Should we
// need them, we could use a streaming algorithm to compute them, like this:
// http://www.cs.rutgers.edu/~muthu/bquant.pdf
//Percent95In uint64
LastIn uint64
TotalIn uint64
MinOut uint64
MaxOut uint64
//Percent95Out uint64
LastOut uint64
TotalOut uint64
}
TrafficTracker tracks traffic in single reporting period
Click to show internal directories.
Click to hide internal directories.