statistic

package
v1.18.12 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2024 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewTCPTracker

func NewTCPTracker(conn C.Conn, manager *Manager, metadata *C.Metadata, rule C.Rule, uploadTotal int64, downloadTotal int64, pushToManager bool) *tcpTracker

func NewUDPTracker

func NewUDPTracker(conn C.PacketConn, manager *Manager, metadata *C.Metadata, rule C.Rule, uploadTotal int64, downloadTotal int64, pushToManager bool) *udpTracker

Types

type Manager

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

func (*Manager) Get

func (m *Manager) Get(id string) (c Tracker)

func (*Manager) Join

func (m *Manager) Join(c Tracker)

func (*Manager) Leave

func (m *Manager) Leave(c Tracker)

func (*Manager) Memory

func (m *Manager) Memory() uint64

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) Range

func (m *Manager) Range(f func(c Tracker) bool)

func (*Manager) ResetStatistic

func (m *Manager) ResetStatistic()

func (*Manager) Snapshot

func (m *Manager) Snapshot() *Snapshot

func (*Manager) Statistic added in v1.18.9

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

type Snapshot

type Snapshot struct {
	DownloadTotal int64          `json:"downloadTotal"`
	UploadTotal   int64          `json:"uploadTotal"`
	Connections   []*TrackerInfo `json:"connections"`
	Memory        uint64         `json:"memory"`
}

type Tracker

type Tracker interface {
	ID() string
	Close() error
	Info() *TrackerInfo
	C.Connection
}

type TrackerInfo

type TrackerInfo struct {
	UUID          uuid.UUID    `json:"id"`
	Metadata      *C.Metadata  `json:"metadata"`
	UploadTotal   atomic.Int64 `json:"upload"`
	DownloadTotal atomic.Int64 `json:"download"`
	Start         time.Time    `json:"start"`
	Chain         C.Chain      `json:"chains"`
	Rule          string       `json:"rule"`
	RulePayload   string       `json:"rulePayload"`
}

Jump to

Keyboard shortcuts

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