Documentation ¶
Index ¶
- func NewTCPTracker(conn C.Conn, manager *Manager, metadata *C.Metadata, rule C.Rule, ...) *tcpTracker
- func NewUDPTracker(conn C.PacketConn, manager *Manager, metadata *C.Metadata, rule C.Rule, ...) *udpTracker
- type Manager
- func (m *Manager) Get(id string) (c Tracker)
- func (m *Manager) Join(c Tracker)
- func (m *Manager) Leave(c Tracker)
- func (m *Manager) Memory() uint64
- func (m *Manager) Now() (up int64, down int64)
- func (m *Manager) PushDownloaded(size int64)
- func (m *Manager) PushUploaded(size int64)
- func (m *Manager) Range(f func(c Tracker) bool)
- func (m *Manager) ResetStatistic()
- func (m *Manager) Snapshot() *Snapshot
- func (m *Manager) Statistic() (up int64, down int64)
- type Snapshot
- type Tracker
- type TrackerInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewTCPTracker ¶
Types ¶
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
var DefaultManager *Manager
func (*Manager) PushDownloaded ¶
func (*Manager) PushUploaded ¶
func (*Manager) ResetStatistic ¶
func (m *Manager) ResetStatistic()
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"` }
Click to show internal directories.
Click to hide internal directories.