BytesToPacket converts []bytes to Packet
(ntpPacketBytes []byte)
| 133 | |
| 134 | // putHeader writes the fixed 48-octet NTP header (RFC 5905) into dst in wire |
| 135 | // order, big-endian. dst must be at least PacketSizeBytes long. This hand-rolled |
| 136 | // codec replaces reflection-based binary.Write over a []any field list, keeping |
| 137 | // the hot request/response path allocation-free. |
| 138 | func (p *Packet) putHeader(dst []byte) { |
| 139 | _ = dst[PacketSizeBytes-1] // bounds-check hint: panic early if dst too short |
| 140 | dst[0] = p.Settings |
| 141 | dst[1] = p.Stratum |
searching dependent graphs…