2 Package rudp implements the low-level Minetest protocol described at
3 https://dev.minetest.net/Network_Protocol#Low-level_protocol.
14 var be = binary.BigEndian
25 var ErrTimedOut = errors.New("timed out")
28 ConnTimeout = 30 * time.Second
29 PingTimeout = 5 * time.Second
33 MaxRelPktSize = 32439825
34 MaxUnrelPktSize = 32636430
37 // protoID must be at the start of every UDP packet.
38 const protoID uint32 = 0x4f457403
40 // PeerIDs aren't actually used to identify peers, IP addresses and ports are,
41 // these just exist for backward compatibility.
45 // Used by clients before the server sets their ID.
46 PeerIDNil PeerID = iota
48 // The server always has this ID.
51 // Lowest ID the server can assign to a client.
83 ctlPing // Sent to prevent timeout.
93 // Reliable packets in a channel are be received in the order they are sent in.
94 // A Channel must be less than ChannelCount.
97 const ChannelCount Channel = 3
102 // Unrel (unreliable) packets may be dropped, duplicated or reordered.
106 // seqnums are sequence numbers used to maintain reliable packet order
107 // and identify split packets.
110 const initSeqnum seqnum = 65500