From c8e3a165545b0caa5f724e62fbe9ab3d5305e6f5 Mon Sep 17 00:00:00 2001 From: shoopea Date: Mon, 15 Jun 2020 12:46:48 +0200 Subject: [PATCH] test --- packet.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/packet.go b/packet.go index 03c9674..80d2ad7 100644 --- a/packet.go +++ b/packet.go @@ -104,6 +104,11 @@ type PacketAdminUpdateFrequency struct { UpdateFrequency uint16 } +type PacketAdminServerDate struct { + Packet + Date uint32 +} + func (p *PacketAdminJoin) Bytes() []byte { buf := new(bytes.Buffer) p.PLength = uint16(len(p.Password) + len(p.AppName) + len(p.AppVersion) + 6) @@ -171,6 +176,11 @@ func (p *PacketAdminServerProtocol) Read(b []byte) { p.FrequenciesAllowed = binary.LittleEndian.Uint16(bs[2:]) } -func readPacket(p Packet, b []byte) { +func (p *PacketAdminServerDate) Read(b []byte) { + r := bufio.NewReader(bytes.NewReader(b)) + r.Discard(3) + bs := make([]byte, 4) + _, _ = r.Read(bs) + p.Date = binary.LittleEndian.Uint32(bs[0:]) }