Documentation
¶
Overview ¶
This is a port of reliable.io to Go. See also https://gafferongames.com/post/reliable_ordered_messages/
Index ¶
- Constants
- type Config
- type Endpoint
- func (e *Endpoint) Bandwidth() (float64, float64, float64)
- func (e *Endpoint) ClearAcks()
- func (e *Endpoint) GetAcks() []uint16
- func (e *Endpoint) NextPacketSequence() uint16
- func (e *Endpoint) PacketLoss() float64
- func (e *Endpoint) PacketsAcked() uint64
- func (e *Endpoint) PacketsReceived() uint64
- func (e *Endpoint) PacketsSent() uint64
- func (e *Endpoint) ReceivePacket(packetData []byte)
- func (e *Endpoint) Reset()
- func (e *Endpoint) Rtt() float64
- func (e *Endpoint) SendPacket(packetData []byte)
- func (e *Endpoint) Update(time float64)
Constants ¶
const ( MaxPacketHeaderBytes = 9 FragmentHeaderBytes = 5 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { Name string Context interface{} Index int MaxPacketSize int FragmentAbove int MaxFragments int FragmentSize int AckBufferSize int SentPacketsBufferSize int ReceivedPacketsBufferSize int FragmentReassemblyBufferSize int RttSmoothingFactor float64 PacketLossSmoothingFactor float64 BandwidthSmoothingFactor float64 PacketHeaderSize int // TransmitPacketFunction is called by SendPacket to do the actual transmitting of packets TransmitPacketFunction func(interface{}, int, uint16, []byte) // ProcessPacketFunction is called by ReceivePacket once a fully assembled packet is received ProcessPacketFunction func(interface{}, int, uint16, []byte) bool // Allocate can be used to implement custom memory allocation Allocate func(int) []byte // Free can be used to implement custom memory allocation Free func([]byte) }
Config holds endpoint configuration data
func NewDefaultConfig ¶
func NewDefaultConfig() *Config
NewDefaultConfig creates a typical endpoint configuration
type Endpoint ¶
type Endpoint struct {
// contains filtered or unexported fields
}
Endpoint is a reliable udp endpoint
func NewEndpoint ¶
NewEndpoint creates an endpoint
func (*Endpoint) ClearAcks ¶
func (e *Endpoint) ClearAcks()
ClearAcks clears the endpoints ack array
func (*Endpoint) NextPacketSequence ¶
NextPacketSequence returns the next packet sequence that will be used
func (*Endpoint) PacketLoss ¶
PacketLoss returns the percent of packets lost this endpoint is experiencing
func (*Endpoint) PacketsAcked ¶
PacketsAcked returns the number of packets acked
func (*Endpoint) PacketsReceived ¶
PacketsReceived returns the number of packets received
func (*Endpoint) PacketsSent ¶
PacketsSent returns the number of packets sent
func (*Endpoint) ReceivePacket ¶
ReceivePacket reliably receives a packet of data sent by SendPacket
func (*Endpoint) SendPacket ¶
SendPacket reliably sends one or more packets with the passed