stats

package
v0.15.0 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2023 License: GPL-3.0 Imports: 5 Imported by: 2

Documentation

Index

Constants

View Source
const (
	UpProxy   = "outbound>>>proxy>>>traffic>>>uplink"
	DownProxy = "outbound>>>proxy>>>traffic>>>downlink"
)

Variables

This section is empty.

Functions

func NewConn

func NewConn(c net.Conn) net.Conn

Types

type Counter

type Counter struct {
	// contains filtered or unexported fields
}

Counter is an implementation of stats.Counter.

func (*Counter) Add

func (c *Counter) Add(delta int64) int64

Add implements stats.Counter.

func (*Counter) Set

func (c *Counter) Set(newValue int64) int64

Set implements stats.Counter.

func (*Counter) Value

func (c *Counter) Value() int64

Value implements stats.Counter.

type Manager

type Manager struct {
	// contains filtered or unexported fields
}
var DefaultManager *Manager = nil

func NewManager

func NewManager() (*Manager, error)

NewManager creates an instance of Statistics Manager.

func (*Manager) GetCounter

func (m *Manager) GetCounter(name string) *Counter

func (*Manager) RegisterCounter

func (m *Manager) RegisterCounter(name string) (*Counter, error)

RegisterCounter implements stats.Manager.

func (*Manager) UnregisterCounter

func (m *Manager) UnregisterCounter(name string) error

type StatsConn

type StatsConn struct {
	net.Conn
	CounterDown *Counter
	CounterUp   *Counter
}

func NewStatsConn

func NewStatsConn(c net.Conn) StatsConn

func (StatsConn) Read

func (s StatsConn) Read(b []byte) (n int, err error)

func (StatsConn) Write

func (s StatsConn) Write(b []byte) (n int, err error)

type StatsPacketConn

type StatsPacketConn struct {
	net.PacketConn
	CounterDown *Counter
	CounterUp   *Counter
}

func NewStatsPacketConn

func NewStatsPacketConn(pc net.PacketConn) StatsPacketConn

func (StatsPacketConn) ReadFrom

func (pc StatsPacketConn) ReadFrom(p []byte) (n int, addr net.Addr, err error)

func (StatsPacketConn) WriteTo

func (pc StatsPacketConn) WriteTo(p []byte, addr net.Addr) (n int, err error)

Jump to

Keyboard shortcuts

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