2 Package rudp implements the low-level Minetest protocol described at
3 https://dev.minetest.net/Network_Protocol#Low-level_protocol.
5 All exported functions and methods in this package are safe for concurrent use
6 by multiple goroutines.
10 import "encoding/binary"
12 var be = binary.BigEndian
14 // protoID must be at the start of every network packet.
15 const protoID uint32 = 0x4f457403
17 // PeerIDs aren't actually used to identify peers, network addresses are,
18 // these just exist for backward compatability.
22 // Used by clients before the server sets their ID.
23 PeerIDNil PeerID = iota
25 // The server always has this ID.
28 // Lowest ID the server can assign to a client.
32 // ChannelCount is the maximum channel number + 1.
33 const ChannelCount = 3
36 rawPkt.Data format (big endian):
44 // Tells peer you received a rawTypeRel
45 // and it doesn't need to resend it.
48 // Tells peer to send packets with this Src PeerID.
51 // Sent to prevent timeout.
53 // Tells peer that you disconnected.
58 // Packet larger than MaxNetPktSize split into smaller packets.
59 // Packets with I >= Count should be ignored.
60 // Once all Count chunks are recieved, they are sorted by I and
61 // concatenated to make a Pkt.(Data).
62 seqnum // Identifies split packet.
66 // Resent until a ctlAck with same seqnum is recieved.
67 // seqnums are sequencial and start at seqnumInit,
68 // These should be processed in seqnum order.
82 rawTypeCtl rawType = iota
103 // seqnums are sequence numbers used to maintain reliable packet order
104 // and to identify split packets.
107 const seqnumInit seqnum = 65500