metrics

package
v1.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 19, 2020 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MeasureConn

func MeasureConn(conn onet.DuplexConn, bytesSent, bytesReceived *int64) onet.DuplexConn

Types

type ProxyMetrics

type ProxyMetrics struct {
	ClientProxy int64
	ProxyTarget int64
	TargetProxy int64
	ProxyClient int64
}

type ShadowsocksMetrics

type ShadowsocksMetrics interface {
	GetLocation(net.Addr) (string, error)

	SetNumAccessKeys(numKeys int, numPorts int)

	// TCP metrics
	AddOpenTCPConnection(clientLocation string)
	AddClosedTCPConnection(clientLocation, accessKey, status string, data ProxyMetrics, timeToCipher, duration time.Duration)
	AddTCPProbe(clientLocation, status, drainResult string, port int, data ProxyMetrics)

	// UDP metrics
	AddUDPPacketFromClient(clientLocation, accessKey, status string, clientProxyBytes, proxyTargetBytes int, timeToCipher time.Duration)
	AddUDPPacketFromTarget(clientLocation, accessKey, status string, targetProxyBytes, proxyClientBytes int)
	AddUDPNatEntry()
	RemoveUDPNatEntry()
}

ShadowsocksMetrics registers metrics for the Shadowsocks service.

func NewPrometheusShadowsocksMetrics added in v1.1.2

func NewPrometheusShadowsocksMetrics(ipCountryDB *geoip2.Reader, registerer prometheus.Registerer) ShadowsocksMetrics

NewPrometheusShadowsocksMetrics constructs a metrics object that uses `ipCountryDB` to convert IP addresses to countries, and reports all metrics to Prometheus via `registerer`. `ipCountryDB` may be nil, but `registerer` must not be.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL