trafficontrol

package
v0.0.0-...-6478c7e Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2024 License: GPL-2.0 Imports: 15 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
}

func NewManager

func NewManager() *Manager

func (*Manager) Close

func (m *Manager) Close() error

func (*Manager) ClosedConnections

func (m *Manager) ClosedConnections() []TrackerMetadata

func (*Manager) Connection

func (m *Manager) Connection(id uuid.UUID) Tracker

func (*Manager) Connections

func (m *Manager) Connections() []TrackerMetadata

func (*Manager) ConnectionsLen

func (m *Manager) ConnectionsLen() int

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

func (*Manager) Total

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

type Snapshot

type Snapshot struct {
	Download    int64
	Upload      int64
	Connections []Tracker
	Memory      uint64
}

func (*Snapshot) MarshalJSON

func (s *Snapshot) MarshalJSON() ([]byte, error)

type TCPConn

type TCPConn struct {
	N.ExtendedConn
	// contains filtered or unexported fields
}

func NewTCPTracker

func NewTCPTracker(conn net.Conn, manager *Manager, metadata adapter.InboundContext, router adapter.Router, rule adapter.Rule) *TCPConn

func (*TCPConn) Close

func (tt *TCPConn) Close() error

func (*TCPConn) Leave

func (tt *TCPConn) Leave()

func (*TCPConn) Metadata

func (tt *TCPConn) Metadata() TrackerMetadata

func (*TCPConn) ReaderReplaceable

func (tt *TCPConn) ReaderReplaceable() bool

func (*TCPConn) Upstream

func (tt *TCPConn) Upstream() any

func (*TCPConn) WriterReplaceable

func (tt *TCPConn) WriterReplaceable() bool

type Tracker

type Tracker interface {
	adapter.Tracker
	Metadata() TrackerMetadata
	Close() error
}

type TrackerMetadata

type TrackerMetadata struct {
	ID           uuid.UUID
	Metadata     adapter.InboundContext
	CreatedAt    time.Time
	ClosedAt     time.Time
	Upload       *atomic.Int64
	Download     *atomic.Int64
	Chain        []string
	Rule         adapter.Rule
	Outbound     string
	OutboundType string
}

func (TrackerMetadata) MarshalJSON

func (t TrackerMetadata) MarshalJSON() ([]byte, error)

type UDPConn

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

func NewUDPTracker

func NewUDPTracker(conn N.PacketConn, manager *Manager, metadata adapter.InboundContext, router adapter.Router, rule adapter.Rule) *UDPConn

func (*UDPConn) Close

func (ut *UDPConn) Close() error

func (*UDPConn) Leave

func (ut *UDPConn) Leave()

func (*UDPConn) Metadata

func (ut *UDPConn) Metadata() TrackerMetadata

func (*UDPConn) ReaderReplaceable

func (ut *UDPConn) ReaderReplaceable() bool

func (*UDPConn) Upstream

func (ut *UDPConn) Upstream() any

func (*UDPConn) WriterReplaceable

func (ut *UDPConn) WriterReplaceable() bool

Jump to

Keyboard shortcuts

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