Documentation ¶
Index ¶
- func MeasureConn(conn onet.DuplexConn, bytesSent, bytesReceived *int64) onet.DuplexConn
- type NoOpMetrics
- func (m *NoOpMetrics) AddClosedTCPConnection(clientLocation, accessKey, status string, data ProxyMetrics, ...)
- func (m *NoOpMetrics) AddOpenTCPConnection(clientLocation string)
- func (m *NoOpMetrics) AddTCPProbe(clientLocation, status, drainResult string, port int, data ProxyMetrics)
- func (m *NoOpMetrics) AddUDPNatEntry()
- func (m *NoOpMetrics) AddUDPPacketFromClient(clientLocation, accessKey, status string, ...)
- func (m *NoOpMetrics) AddUDPPacketFromTarget(clientLocation, accessKey, status string, ...)
- func (m *NoOpMetrics) GetLocation(net.Addr) (string, error)
- func (m *NoOpMetrics) RemoveUDPNatEntry()
- func (m *NoOpMetrics) SetBuildInfo(version string)
- func (m *NoOpMetrics) SetNumAccessKeys(numKeys int, numPorts int)
- type ProxyMetrics
- type ShadowsocksMetrics
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 NoOpMetrics ¶
type NoOpMetrics struct{}
NoOpMetrics is a fake ShadowsocksMetrics that doesn't do anything. Useful in tests or if you don't want to track metrics.
func (*NoOpMetrics) AddClosedTCPConnection ¶
func (m *NoOpMetrics) AddClosedTCPConnection(clientLocation, accessKey, status string, data ProxyMetrics, timeToCipher, duration time.Duration)
func (*NoOpMetrics) AddOpenTCPConnection ¶
func (m *NoOpMetrics) AddOpenTCPConnection(clientLocation string)
func (*NoOpMetrics) AddTCPProbe ¶
func (m *NoOpMetrics) AddTCPProbe(clientLocation, status, drainResult string, port int, data ProxyMetrics)
func (*NoOpMetrics) AddUDPNatEntry ¶
func (m *NoOpMetrics) AddUDPNatEntry()
func (*NoOpMetrics) AddUDPPacketFromClient ¶
func (m *NoOpMetrics) AddUDPPacketFromClient(clientLocation, accessKey, status string, clientProxyBytes, proxyTargetBytes int, timeToCipher time.Duration)
func (*NoOpMetrics) AddUDPPacketFromTarget ¶
func (m *NoOpMetrics) AddUDPPacketFromTarget(clientLocation, accessKey, status string, targetProxyBytes, proxyClientBytes int)
func (*NoOpMetrics) GetLocation ¶
func (m *NoOpMetrics) GetLocation(net.Addr) (string, error)
func (*NoOpMetrics) RemoveUDPNatEntry ¶
func (m *NoOpMetrics) RemoveUDPNatEntry()
func (*NoOpMetrics) SetBuildInfo ¶
func (m *NoOpMetrics) SetBuildInfo(version string)
func (*NoOpMetrics) SetNumAccessKeys ¶
func (m *NoOpMetrics) SetNumAccessKeys(numKeys int, numPorts int)
type ProxyMetrics ¶
type ShadowsocksMetrics ¶
type ShadowsocksMetrics interface { SetBuildInfo(version string) 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 ¶
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.
Click to show internal directories.
Click to hide internal directories.