Documentation ¶
Index ¶
Constants ¶
View Source
const ( // MaximumSegmentLength is the length of the largest possible segment // including overhead. MaximumSegmentLength = 1500 - 52 // LengthLength is the number of bytes used to represent length LengthLength = 2 // TypeLength is the number of bytes used to indicate packet type TypeLength = 1 ConsumeReadSize = MaximumSegmentLength * 16 )
Variables ¶
View Source
var ErrAgain = errors.New("framing: More data needed to decode")
ErrAgain is the error returned when decoding requires more data to continue.
View Source
var ErrTagMismatch = errors.New("framing: Poly1305 tag mismatch")
Error returned when Decoder.Decode() failes to authenticate a frame.
Functions ¶
Types ¶
type BaseDecoder ¶
type BaseDecoder struct { Drbg *drbg.HashDrbg LengthLength int MinPayloadLength int PacketOverhead int MaxFramePayloadLength int NextLength uint16 NextLengthInvalid bool PayloadOverhead overheadFunc DecodeLength decodeLengthfunc DecodePayload decodePayloadfunc ParsePacket parsePacketFunc Cleanup cleanupfunc ReceiveBuffer *bytes.Buffer ReceiveDecodedBuffer *bytes.Buffer // contains filtered or unexported fields }
func (*BaseDecoder) Decode ¶
Decode decodes a stream of data and returns the length if any. ErrAgain is a temporary failure, all other errors MUST be treated as fatal and the session aborted.
func (*BaseDecoder) InitBuffers ¶
func (decoder *BaseDecoder) InitBuffers()
type BaseEncoder ¶
type BaseEncoder struct { Drbg *drbg.HashDrbg MaxPacketPayloadLength int LengthLength int PayloadOverhead overheadFunc Encode encodeFunc ProcessLength processLengthFunc ChopPayload chopPayloadFunc Type string }
BaseEncoder implements the core encoder vars and functions
func (*BaseEncoder) MakePacket ¶
func (encoder *BaseEncoder) MakePacket(w io.Writer, payload []byte) error
type InvalidPacketLengthError ¶
type InvalidPacketLengthError int
InvalidPacketLengthError is the error returned when decodePacket detects a invalid packet length/
func (InvalidPacketLengthError) Error ¶
func (e InvalidPacketLengthError) Error() string
type InvalidPayloadLengthError ¶
type InvalidPayloadLengthError int
InvalidPayloadLengthError is the error returned when Encoder.Encode() rejects the payload length.
func (InvalidPayloadLengthError) Error ¶
func (e InvalidPayloadLengthError) Error() string
Click to show internal directories.
Click to hide internal directories.