Documentation
¶
Index ¶
- Constants
- type Conn
- type PacketConn
- type Stat
- func (s *Stat) AddRx(len uint64)
- func (s *Stat) AddTx(len uint64)
- func (s *Stat) Bandwidth1() (r, t uint64, lastTime time.Time)
- func (s *Stat) Bandwidth10() (r, t uint64, lastTime time.Time)
- func (s *Stat) Reset()
- func (s *Stat) RunBandwidthIn1()
- func (s *Stat) RunBandwidthIn10()
- func (s *Stat) StopBandwidthIn1()
- type StatStatus
Constants ¶
View Source
const ( FlagRatelimit = 1 << iota FlagStat )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PacketConn ¶
type PacketConn struct { net.PacketConn Flag int TxBucket *ratelimit.Bucket RxBucket *ratelimit.Bucket Stat *Stat }
func UpgradePacketConn ¶
func UpgradePacketConn(pc net.PacketConn) *PacketConn
func (*PacketConn) EnableStat ¶
func (c *PacketConn) EnableStat(stat *Stat)
type Stat ¶
type Stat struct { Rx uint64 `json:"rx"` Tx uint64 `json:"tx"` In1 StatStatus `json:"in1"` In10 StatStatus `json:"in10"` // contains filtered or unexported fields }
func (*Stat) RunBandwidthIn1 ¶
func (s *Stat) RunBandwidthIn1()
func (*Stat) RunBandwidthIn10 ¶
func (s *Stat) RunBandwidthIn10()
func (*Stat) StopBandwidthIn1 ¶
func (s *Stat) StopBandwidthIn1()
Click to show internal directories.
Click to hide internal directories.