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:]) }