Documentation ¶
Index ¶
- Constants
- type FECHelper
- type FECInfo
- type QConn
- func (qc *QConn) Close() error
- func (qc *QConn) LocalAddr() net.Addr
- func (qc *QConn) Read(b []byte) (readLen int, err error)
- func (qc *QConn) RemoteAddr() net.Addr
- func (qc *QConn) SetDeadline(t time.Time) error
- func (qc *QConn) SetReadDeadline(t time.Time) error
- func (qc *QConn) SetWriteDeadline(t time.Time) error
- func (qc *QConn) Write(b []byte) (n int, err error)
- type QTimeoutErr
- type QvicMgr
- type ReceiverMgr
- type SenderMgr
- type SpeedMeter
- type TokenBucket
- type VBitVec
- func (v *VBitVec) Attatch(p []byte, _bitLen uint, flag byte)
- func (v *VBitVec) BitXor(c1 *VBitVec, c2 *VBitVec)
- func (v *VBitVec) BitXor1(c1 *VBitVec)
- func (v *VBitVec) Detach()
- func (v *VBitVec) GetBit(idx uint) bool
- func (v *VBitVec) GetBitmapString() (str string)
- func (v *VBitVec) GetFlagBit(idx uint) bool
- func (v *VBitVec) Init(_bitLen uint) bool
- func (v *VBitVec) InitPattern(flag byte, len uint)
- func (v *VBitVec) SetBit(idx uint, val bool)
- type VPacket
- type VPacketItem
Constants ¶
const ( StatusNone = 0 StatusConnecting = 1 StatusConnected = 2 StatusClosing = 3 StatusClosed = 4 DefaultFECBundle = 16 // default packet number every bundle. DefaultFECLen = 3 // default extra packets number every bundle. DefaultJitter = 40 VPacketDataLen = 1380 DefaultWinSize = 4096 // default window size for QConn. DefaultRecvPacketLength = 2048 ExtraLenPaddingInData = 2 )
Qvic const
const ( SlotsNum = 16384 // maximum number of qconn that QvicMgr can hold. DefaultPortStart = 50000 DefaultPortEnd = 51023 )
const ( // MaxBitLength Max bit length MaxBitLength uint = 8 // MaxBitIndex Max bit index size MaxBitIndex uint = 7 // ShiftOffset Left/Right shift size ShiftOffset uint = 3 )
const ( // VPacketHeadLen head length in net-package VPacketHeadLen int = 13 PackTypeControl int = 8 PackTypeChannel int = 7 PackTypeData int = 6 PackTypeFEC int = 5 )
const ( // MilliInSec milliseconds in one second MilliInSec uint64 = 1000 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FECHelper ¶
type FECHelper struct {
// contains filtered or unexported fields
}
FECHelper helper class for FEC
func (*FECHelper) GetRecoverInfo ¶
GetRecoverInfo get VBitVec that can recover
type FECInfo ¶
type FECInfo struct {
// contains filtered or unexported fields
}
FECInfo record packages info of a bundle
type QConn ¶
type QConn struct {
// contains filtered or unexported fields
}
QConn represents a qvic connection, implements net.Conn interface.
func (*QConn) RemoteAddr ¶
RemoteAddr returns the remote network address.
type QTimeoutErr ¶
type QTimeoutErr struct {
// contains filtered or unexported fields
}
QTimeoutErr implements net.Error interface, in order to provide unified interface as tcp does.
func NewQTimeoutError ¶
func NewQTimeoutError(s string) *QTimeoutErr
func (*QTimeoutErr) Error ¶
func (e *QTimeoutErr) Error() string
func (*QTimeoutErr) Temporary ¶
func (e *QTimeoutErr) Temporary() bool
func (*QTimeoutErr) Timeout ¶
func (e *QTimeoutErr) Timeout() bool
type QvicMgr ¶
type QvicMgr struct {
// contains filtered or unexported fields
}
QvicMgr manages qvic module.
func (*QvicMgr) DialTimeout ¶
func (mgr *QvicMgr) DialTimeout(network, addr string, timeout time.Duration) (conn net.Conn, err error)
DialTimeout connects to the address on the named network with a timeout config. network parameters must be "tcp" or "qvic" for tcp connection and qvic connection respectively.
type ReceiverMgr ¶
type ReceiverMgr struct {
// contains filtered or unexported fields
}
ReceiverMgr manages QConn's receiver logic.
func NewReceiverMgr ¶
func NewReceiverMgr(qc *QConn) *ReceiverMgr
NewReceiverMgr creates ReceiverMgr object.
type SenderMgr ¶
type SenderMgr struct {
// contains filtered or unexported fields
}
SenderMgr manages QConn's sender logic.
type SpeedMeter ¶
type SpeedMeter struct {
// contains filtered or unexported fields
}
SpeedMeter computes bandwidth
func NewSpeedMeter ¶
func NewSpeedMeter(step uint64, items uint) (s *SpeedMeter)
NewSpeedMeter creates SpeedMeter. step should be ms. for example: step=100 items=10; step=50 items=20. step * items = a period.
func (*SpeedMeter) Feed ¶
func (s *SpeedMeter) Feed(num uint)
Feed called when bytes received from network
type TokenBucket ¶
type TokenBucket struct {
// contains filtered or unexported fields
}
TokenBucket for bucket limit rate
func (*TokenBucket) AdjustBW ¶
func (t *TokenBucket) AdjustBW(bytesPerSecond int64)
AdjustBW adjusts bandwidth anytime
func (*TokenBucket) Consume ¶
func (t *TokenBucket) Consume(tokens int64)
Consume consumes some buckets
func (*TokenBucket) GetCurLooseTokens ¶
func (t *TokenBucket) GetCurLooseTokens() int64
GetCurLooseTokens gets valid tokens, minus reserved
func (*TokenBucket) GetCurTokens ¶
func (t *TokenBucket) GetCurTokens() int64
GetCurTokens gets valid tokens
func (*TokenBucket) Init ¶
func (t *TokenBucket) Init(bytesPerSecond int64)
Init initializes TokenBucket with bytesPerSecond and factor
func (*TokenBucket) PeriodicFeed ¶
func (t *TokenBucket) PeriodicFeed()
PeriodicFeed called periodically, for example 30ms
type VBitVec ¶
type VBitVec struct { BitLen uint ExtFlag byte // flag for extra package // contains filtered or unexported fields }
VBitVec bitmap friendly for FEC helper
func (*VBitVec) GetBitmapString ¶
GetBitmapString gets bitmap string
func (*VBitVec) GetFlagBit ¶
GetFlagBit gets bit in pos of extflag
func (*VBitVec) InitPattern ¶
InitPattern initializes bitmap with pattern
type VPacket ¶
type VPacket struct {
// contains filtered or unexported fields
}
VPacket package for QVIC
type VPacketItem ¶
type VPacketItem struct {
// contains filtered or unexported fields
}
VPacketItem package info for RecverMgr