counter

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2024 License: MPL-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewConnCounter

func NewConnCounter(conn net.Conn, s *TrafficStorage) net.Conn

func NewPacketConnCounter

func NewPacketConnCounter(conn network.PacketConn, s *TrafficStorage) network.PacketConn

Types

type ConnCounter

type ConnCounter struct {
	network.ExtendedConn
	// contains filtered or unexported fields
}

func (*ConnCounter) Read

func (c *ConnCounter) Read(b []byte) (n int, err error)

func (*ConnCounter) ReadBuffer

func (c *ConnCounter) ReadBuffer(buffer *buf.Buffer) error

func (*ConnCounter) UnwrapReader

func (c *ConnCounter) UnwrapReader() (io.Reader, []network.CountFunc)

func (*ConnCounter) UnwrapWriter

func (c *ConnCounter) UnwrapWriter() (io.Writer, []network.CountFunc)

func (*ConnCounter) Upstream

func (c *ConnCounter) Upstream() any

func (*ConnCounter) Write

func (c *ConnCounter) Write(b []byte) (n int, err error)

func (*ConnCounter) WriteBuffer

func (c *ConnCounter) WriteBuffer(buffer *buf.Buffer) error

type PacketConnCounter

type PacketConnCounter struct {
	network.PacketConn
	// contains filtered or unexported fields
}

func (*PacketConnCounter) ReadPacket

func (p *PacketConnCounter) ReadPacket(buff *buf.Buffer) (destination M.Socksaddr, err error)

func (*PacketConnCounter) UnwrapPacketReader

func (p *PacketConnCounter) UnwrapPacketReader() (network.PacketReader, []network.CountFunc)

func (*PacketConnCounter) UnwrapPacketWriter

func (p *PacketConnCounter) UnwrapPacketWriter() (network.PacketWriter, []network.CountFunc)

func (*PacketConnCounter) Upstream

func (p *PacketConnCounter) Upstream() any

func (*PacketConnCounter) WritePacket

func (p *PacketConnCounter) WritePacket(buff *buf.Buffer, destination M.Socksaddr) (err error)

type TrafficCounter

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

func NewTrafficCounter

func NewTrafficCounter() *TrafficCounter

func (*TrafficCounter) DecConn

func (c *TrafficCounter) DecConn(auth string)

func (*TrafficCounter) Delete

func (c *TrafficCounter) Delete(id string)

func (*TrafficCounter) GetCounter

func (c *TrafficCounter) GetCounter(id string) *TrafficStorage

func (*TrafficCounter) GetDownCount

func (c *TrafficCounter) GetDownCount(id string) int64

func (*TrafficCounter) GetUpCount

func (c *TrafficCounter) GetUpCount(id string) int64

func (*TrafficCounter) IncConn

func (c *TrafficCounter) IncConn(auth string)

func (*TrafficCounter) Len

func (c *TrafficCounter) Len() int

func (*TrafficCounter) Reset

func (c *TrafficCounter) Reset(id string)

func (*TrafficCounter) Rx

func (c *TrafficCounter) Rx(id string, n int)

func (*TrafficCounter) Tx

func (c *TrafficCounter) Tx(id string, n int)

type TrafficStorage

type TrafficStorage struct {
	UpCounter   atomic.Int64
	DownCounter atomic.Int64
}

Jump to

Keyboard shortcuts

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