35 lines
588 B
Go
35 lines
588 B
Go
package packets
|
|
|
|
// PacketSerializer interface for common packet operations
|
|
type PacketSerializer interface {
|
|
Serialize(dest []byte) uint32
|
|
Size() uint32
|
|
Copy() PacketSerializer
|
|
}
|
|
|
|
// Stream states
|
|
type StreamState uint8
|
|
|
|
const (
|
|
StateDisconnected StreamState = iota
|
|
StateConnecting
|
|
StateEstablished
|
|
StateClosing
|
|
StateClosed
|
|
)
|
|
|
|
// Packet priority levels
|
|
const (
|
|
PriorityLow uint32 = 0
|
|
PriorityNormal uint32 = 5
|
|
PriorityHigh uint32 = 10
|
|
)
|
|
|
|
// Max packet sizes
|
|
const (
|
|
MaxPacketSize = 0xFFFF
|
|
DefaultMTU = 1450
|
|
MaxCombinedSize = 512
|
|
MaxFragmentChunk = 0xFFFF
|
|
)
|