quic-go: github.com/lucas-clemente/quic-go/internal/utils Index | Files | Directories

package utils

import "github.com/lucas-clemente/quic-go/internal/utils"

Index

Package Files

atomic_bool.go byteinterval_linkedlist.go byteorder.go byteorder_big_endian.go gen.go log.go minmax.go packet_interval.go packetinterval_linkedlist.go streamframe_interval.go timer.go varint.go

Constants

const InfDuration = time.Duration(math.MaxInt64)

InfDuration is a duration of infinite length

func AbsDuration Uses

func AbsDuration(d time.Duration) time.Duration

AbsDuration returns the absolute value of a time duration

func Max Uses

func Max(a, b int) int

Max returns the maximum of two Ints

func MaxByteCount Uses

func MaxByteCount(a, b protocol.ByteCount) protocol.ByteCount

MaxByteCount returns the maximum of two ByteCounts

func MaxDuration Uses

func MaxDuration(a, b time.Duration) time.Duration

MaxDuration returns the max duration

func MaxInt64 Uses

func MaxInt64(a, b int64) int64

MaxInt64 returns the minimum of two int64

func MaxPacketNumber Uses

func MaxPacketNumber(a, b protocol.PacketNumber) protocol.PacketNumber

MaxPacketNumber returns the max packet number

func MaxTime Uses

func MaxTime(a, b time.Time) time.Time

MaxTime returns the later time

func MaxUint32 Uses

func MaxUint32(a, b uint32) uint32

MaxUint32 returns the maximum of two uint32

func MaxUint64 Uses

func MaxUint64(a, b uint64) uint64

MaxUint64 returns the maximum of two uint64

func Min Uses

func Min(a, b int) int

Min returns the minimum of two Ints

func MinByteCount Uses

func MinByteCount(a, b protocol.ByteCount) protocol.ByteCount

MinByteCount returns the minimum of two ByteCounts

func MinDuration Uses

func MinDuration(a, b time.Duration) time.Duration

MinDuration returns the minimum duration

func MinInt64 Uses

func MinInt64(a, b int64) int64

MinInt64 returns the minimum of two int64

func MinNonZeroTime Uses

func MinNonZeroTime(a, b time.Time) time.Time

MinNonZeroTime returns the earlist time that is not time.Time{} If both a and b are time.Time{}, it returns time.Time{}

func MinPacketNumber Uses

func MinPacketNumber(a, b protocol.PacketNumber) protocol.PacketNumber

MinPacketNumber returns the min packet number

func MinTime Uses

func MinTime(a, b time.Time) time.Time

MinTime returns the earlier time

func MinUint32 Uses

func MinUint32(a, b uint32) uint32

MinUint32 returns the maximum of two uint32

func MinUint64 Uses

func MinUint64(a, b uint64) uint64

MinUint64 returns the maximum of two uint64

func ReadVarInt Uses

func ReadVarInt(b io.ByteReader) (uint64, error)

ReadVarInt reads a number in the QUIC varint format

func VarIntLen Uses

func VarIntLen(i uint64) protocol.ByteCount

VarIntLen determines the number of bytes that will be needed to write a number

func WriteVarInt Uses

func WriteVarInt(b *bytes.Buffer, i uint64)

WriteVarInt writes a number in the QUIC varint format

type AtomicBool Uses

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

An AtomicBool is an atomic bool

func (*AtomicBool) Get Uses

func (a *AtomicBool) Get() bool

Get gets the value

func (*AtomicBool) Set Uses

func (a *AtomicBool) Set(value bool)

Set sets the value

type ByteInterval Uses

type ByteInterval struct {
    Start protocol.ByteCount
    End   protocol.ByteCount
}

ByteInterval is an interval from one ByteCount to the other

type ByteIntervalElement Uses

type ByteIntervalElement struct {

    // The value stored with this element.
    Value ByteInterval
    // contains filtered or unexported fields
}

ByteIntervalElement is an element of a linked list.

func (*ByteIntervalElement) Next Uses

func (e *ByteIntervalElement) Next() *ByteIntervalElement

Next returns the next list element or nil.

func (*ByteIntervalElement) Prev Uses

func (e *ByteIntervalElement) Prev() *ByteIntervalElement

Prev returns the previous list element or nil.

type ByteIntervalList Uses

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

ByteIntervalList is a linked list of ByteIntervals.

func NewByteIntervalList Uses

func NewByteIntervalList() *ByteIntervalList

NewByteIntervalList returns an initialized list.

func (*ByteIntervalList) Back Uses

func (l *ByteIntervalList) Back() *ByteIntervalElement

Back returns the last element of list l or nil if the list is empty.

func (*ByteIntervalList) Front Uses

func (l *ByteIntervalList) Front() *ByteIntervalElement

Front returns the first element of list l or nil if the list is empty.

func (*ByteIntervalList) Init Uses

func (l *ByteIntervalList) Init() *ByteIntervalList

Init initializes or clears list l.

func (*ByteIntervalList) InsertAfter Uses

func (l *ByteIntervalList) InsertAfter(v ByteInterval, mark *ByteIntervalElement) *ByteIntervalElement

InsertAfter inserts a new element e with value v immediately after mark and returns e. If mark is not an element of l, the list is not modified. The mark must not be nil.

func (*ByteIntervalList) InsertBefore Uses

func (l *ByteIntervalList) InsertBefore(v ByteInterval, mark *ByteIntervalElement) *ByteIntervalElement

InsertBefore inserts a new element e with value v immediately before mark and returns e. If mark is not an element of l, the list is not modified. The mark must not be nil.

func (*ByteIntervalList) Len Uses

func (l *ByteIntervalList) Len() int

Len returns the number of elements of list l. The complexity is O(1).

func (*ByteIntervalList) MoveAfter Uses

func (l *ByteIntervalList) MoveAfter(e, mark *ByteIntervalElement)

MoveAfter moves element e to its new position after mark. If e or mark is not an element of l, or e == mark, the list is not modified. The element and mark must not be nil.

func (*ByteIntervalList) MoveBefore Uses

func (l *ByteIntervalList) MoveBefore(e, mark *ByteIntervalElement)

MoveBefore moves element e to its new position before mark. If e or mark is not an element of l, or e == mark, the list is not modified. The element and mark must not be nil.

func (*ByteIntervalList) MoveToBack Uses

func (l *ByteIntervalList) MoveToBack(e *ByteIntervalElement)

MoveToBack moves element e to the back of list l. If e is not an element of l, the list is not modified. The element must not be nil.

func (*ByteIntervalList) MoveToFront Uses

func (l *ByteIntervalList) MoveToFront(e *ByteIntervalElement)

MoveToFront moves element e to the front of list l. If e is not an element of l, the list is not modified. The element must not be nil.

func (*ByteIntervalList) PushBack Uses

func (l *ByteIntervalList) PushBack(v ByteInterval) *ByteIntervalElement

PushBack inserts a new element e with value v at the back of list l and returns e.

func (*ByteIntervalList) PushBackList Uses

func (l *ByteIntervalList) PushBackList(other *ByteIntervalList)

PushBackList inserts a copy of an other list at the back of list l. The lists l and other may be the same. They must not be nil.

func (*ByteIntervalList) PushFront Uses

func (l *ByteIntervalList) PushFront(v ByteInterval) *ByteIntervalElement

PushFront inserts a new element e with value v at the front of list l and returns e.

func (*ByteIntervalList) PushFrontList Uses

func (l *ByteIntervalList) PushFrontList(other *ByteIntervalList)

PushFrontList inserts a copy of an other list at the front of list l. The lists l and other may be the same. They must not be nil.

func (*ByteIntervalList) Remove Uses

func (l *ByteIntervalList) Remove(e *ByteIntervalElement) ByteInterval

Remove removes e from l if e is an element of list l. It returns the element value e.Value. The element must not be nil.

type ByteOrder Uses

type ByteOrder interface {
    ReadUint32(io.ByteReader) (uint32, error)
    ReadUint24(io.ByteReader) (uint32, error)
    ReadUint16(io.ByteReader) (uint16, error)

    WriteUint32(*bytes.Buffer, uint32)
    WriteUint24(*bytes.Buffer, uint32)
    WriteUint16(*bytes.Buffer, uint16)
}

A ByteOrder specifies how to convert byte sequences into 16-, 32-, or 64-bit unsigned integers.

var BigEndian ByteOrder = bigEndian{}

BigEndian is the big-endian implementation of ByteOrder.

type LogLevel Uses

type LogLevel uint8

LogLevel of quic-go

const (
    // LogLevelNothing disables
    LogLevelNothing LogLevel = iota
    // LogLevelError enables err logs
    LogLevelError
    // LogLevelInfo enables info logs (e.g. packets)
    LogLevelInfo
    // LogLevelDebug enables debug logs (e.g. packet contents)
    LogLevelDebug
)

type Logger Uses

type Logger interface {
    SetLogLevel(LogLevel)
    SetLogTimeFormat(format string)
    WithPrefix(prefix string) Logger
    Debug() bool

    Errorf(format string, args ...interface{})
    Infof(format string, args ...interface{})
    Debugf(format string, args ...interface{})
}

A Logger logs.

var DefaultLogger Logger

DefaultLogger is used by quic-go for logging.

type PacketInterval Uses

type PacketInterval struct {
    Start protocol.PacketNumber
    End   protocol.PacketNumber
}

PacketInterval is an interval from one PacketNumber to the other

type PacketIntervalElement Uses

type PacketIntervalElement struct {

    // The value stored with this element.
    Value PacketInterval
    // contains filtered or unexported fields
}

PacketIntervalElement is an element of a linked list.

func (*PacketIntervalElement) Next Uses

func (e *PacketIntervalElement) Next() *PacketIntervalElement

Next returns the next list element or nil.

func (*PacketIntervalElement) Prev Uses

func (e *PacketIntervalElement) Prev() *PacketIntervalElement

Prev returns the previous list element or nil.

type PacketIntervalList Uses

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

PacketIntervalList is a linked list of PacketIntervals.

func NewPacketIntervalList Uses

func NewPacketIntervalList() *PacketIntervalList

NewPacketIntervalList returns an initialized list.

func (*PacketIntervalList) Back Uses

func (l *PacketIntervalList) Back() *PacketIntervalElement

Back returns the last element of list l or nil if the list is empty.

func (*PacketIntervalList) Front Uses

func (l *PacketIntervalList) Front() *PacketIntervalElement

Front returns the first element of list l or nil if the list is empty.

func (*PacketIntervalList) Init Uses

func (l *PacketIntervalList) Init() *PacketIntervalList

Init initializes or clears list l.

func (*PacketIntervalList) InsertAfter Uses

func (l *PacketIntervalList) InsertAfter(v PacketInterval, mark *PacketIntervalElement) *PacketIntervalElement

InsertAfter inserts a new element e with value v immediately after mark and returns e. If mark is not an element of l, the list is not modified. The mark must not be nil.

func (*PacketIntervalList) InsertBefore Uses

func (l *PacketIntervalList) InsertBefore(v PacketInterval, mark *PacketIntervalElement) *PacketIntervalElement

InsertBefore inserts a new element e with value v immediately before mark and returns e. If mark is not an element of l, the list is not modified. The mark must not be nil.

func (*PacketIntervalList) Len Uses

func (l *PacketIntervalList) Len() int

Len returns the number of elements of list l. The complexity is O(1).

func (*PacketIntervalList) MoveAfter Uses

func (l *PacketIntervalList) MoveAfter(e, mark *PacketIntervalElement)

MoveAfter moves element e to its new position after mark. If e or mark is not an element of l, or e == mark, the list is not modified. The element and mark must not be nil.

func (*PacketIntervalList) MoveBefore Uses

func (l *PacketIntervalList) MoveBefore(e, mark *PacketIntervalElement)

MoveBefore moves element e to its new position before mark. If e or mark is not an element of l, or e == mark, the list is not modified. The element and mark must not be nil.

func (*PacketIntervalList) MoveToBack Uses

func (l *PacketIntervalList) MoveToBack(e *PacketIntervalElement)

MoveToBack moves element e to the back of list l. If e is not an element of l, the list is not modified. The element must not be nil.

func (*PacketIntervalList) MoveToFront Uses

func (l *PacketIntervalList) MoveToFront(e *PacketIntervalElement)

MoveToFront moves element e to the front of list l. If e is not an element of l, the list is not modified. The element must not be nil.

func (*PacketIntervalList) PushBack Uses

func (l *PacketIntervalList) PushBack(v PacketInterval) *PacketIntervalElement

PushBack inserts a new element e with value v at the back of list l and returns e.

func (*PacketIntervalList) PushBackList Uses

func (l *PacketIntervalList) PushBackList(other *PacketIntervalList)

PushBackList inserts a copy of an other list at the back of list l. The lists l and other may be the same. They must not be nil.

func (*PacketIntervalList) PushFront Uses

func (l *PacketIntervalList) PushFront(v PacketInterval) *PacketIntervalElement

PushFront inserts a new element e with value v at the front of list l and returns e.

func (*PacketIntervalList) PushFrontList Uses

func (l *PacketIntervalList) PushFrontList(other *PacketIntervalList)

PushFrontList inserts a copy of an other list at the front of list l. The lists l and other may be the same. They must not be nil.

func (*PacketIntervalList) Remove Uses

func (l *PacketIntervalList) Remove(e *PacketIntervalElement) PacketInterval

Remove removes e from l if e is an element of list l. It returns the element value e.Value. The element must not be nil.

type Timer Uses

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

A Timer wrapper that behaves correctly when resetting

func NewTimer Uses

func NewTimer() *Timer

NewTimer creates a new timer that is not set

func (*Timer) Chan Uses

func (t *Timer) Chan() <-chan time.Time

Chan returns the channel of the wrapped timer

func (*Timer) Reset Uses

func (t *Timer) Reset(deadline time.Time)

Reset the timer, no matter whether the value was read or not

func (*Timer) SetRead Uses

func (t *Timer) SetRead()

SetRead should be called after the value from the chan was read

Directories

PathSynopsis
linkedlist

Package utils imports 10 packages (graph) and is imported by 71 packages. Updated 2019-08-30. Refresh now. Tools for package owners.