statistic

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Manager

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

func (*Manager) Join

func (m *Manager) Join(c tracker)

func (*Manager) Leave

func (m *Manager) Leave(c tracker)

func (*Manager) Now

func (m *Manager) Now() (up int64, down int64)

func (*Manager) PushDownloaded

func (m *Manager) PushDownloaded(size int64)

func (*Manager) PushUploaded

func (m *Manager) PushUploaded(size int64)

func (*Manager) ResetStatistic

func (m *Manager) ResetStatistic()

func (*Manager) Snapshot

func (m *Manager) Snapshot() *Snapshot

type Snapshot

type Snapshot struct {
	DownloadTotal int64     `json:"downloadTotal"`
	UploadTotal   int64     `json:"uploadTotal"`
	Connections   []tracker `json:"connections"`
}

type TcpTracker

type TcpTracker struct {
	constant.Conn `json:"-"`
	// contains filtered or unexported fields
}

func NewTCPTracker

func NewTCPTracker(conn constant.Conn, manager *Manager, metadata *constant.Metadata) *TcpTracker

func (*TcpTracker) Close

func (tt *TcpTracker) Close() error

func (*TcpTracker) ID

func (tt *TcpTracker) ID() string

func (*TcpTracker) Read

func (tt *TcpTracker) Read(b []byte) (int, error)

func (*TcpTracker) Write

func (tt *TcpTracker) Write(b []byte) (int, error)

type UdpTracker

type UdpTracker struct {
	constant.PacketConn `json:"-"`
	// contains filtered or unexported fields
}

func NewUDPTracker

func NewUDPTracker(conn constant.PacketConn, manager *Manager, metadata *constant.Metadata) *UdpTracker

func (*UdpTracker) Close

func (ut *UdpTracker) Close() error

func (*UdpTracker) ID

func (ut *UdpTracker) ID() string

func (*UdpTracker) ReadFrom

func (ut *UdpTracker) ReadFrom(b []byte) (int, net.Addr, error)

func (*UdpTracker) WriteTo

func (ut *UdpTracker) WriteTo(b []byte, addr net.Addr) (int, error)

Jump to

Keyboard shortcuts

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