Documentation ¶
Index ¶
Constants ¶
const (
// BcastHeightPos is position in packet binary of height byte.
BcastHeightPos = 20
)
const (
// BlockSize - max length of an encoding symbol that can fit into a single wire packet.
BlockSize = maxUDPLength - 8 - 2 - 2 - 4 - 4 - 8
)
Variables ¶
var ( // ErrTooLargeUDP packet cannot fit into default MTU of 1500. ErrTooLargeUDP = errors.New("packet cannot fit into default MTU of 1500") )
Functions ¶
func CompileRaptorRFC5053 ¶ added in v0.4.3
func CompileRaptorRFC5053(height byte, message []byte, redundancyFactor uint8) ([]byte, [][]byte, error)
CompileRaptorRFC5053 compiles raptorRFC5053 blocks from message with a specified redundancyFactor. In Kadcast, one could compile blocks once but send them to multiple delegates.
Types ¶
type Decoder ¶
type Decoder struct {
// contains filtered or unexported fields
}
Decoder is based on fountain.newRaptorDecoder.
func NewDecoder ¶
NewDecoder creates a wrapper decoder of fountain.Decoder.
type Encoder ¶
type Encoder struct { SymbolAlignmentSize uint16 // output parameters. PaddingSize uint16 NumSourceSymbols int // contains filtered or unexported fields }
Encoder is wrapper around Raptor RFC5053 from gofountain.EncodeLTBlocks.
func NewEncoder ¶
func NewEncoder(message []byte, maxPacketSize uint16, redundancyFactor uint8, symbolAlignmentSize uint16) (*Encoder, error)
NewEncoder creates a Raptor RFC5053 wrapper.
func (*Encoder) GenerateBlocks ¶
GenerateBlocks encodes raptor codes. NB: This method is destructive to the w.message array.
func (*Encoder) TransferLength ¶
TransferLength is the number of message plus calculated padding.
type MessageCollector ¶
MessageCollector callback to be run on a newly decoded message.
type Packet ¶
type Packet struct { NumSourceSymbols uint16 PaddingSize uint16 // contains filtered or unexported fields }
Packet is the UDP packet that consists of encoding symbol data unit and raptor-specific data.
type UDPReader ¶
type UDPReader struct {
// contains filtered or unexported fields
}
UDPReader that supports decoding Raptor codes packets.
func NewUDPReader ¶
func NewUDPReader(lAddr *net.UDPAddr, h MessageCollector) (*UDPReader, error)
NewUDPReader instantiate a UDP reader of raptor code packets.