This commit is contained in:
shoopea 2020-06-14 17:12:58 +02:00
parent 33a55bf92d
commit 1b25deb818

15
def.go
View File

@ -51,15 +51,18 @@ type Packet struct {
type PacketAdminJoin struct {
Packet
Password []byte
AppName []byte
AppVersion []byte
Password string
AppName string
AppVersion string
}
func (p *PacketAdminJoin) Bytes() []byte {
buf := new(bytes.Buffer)
p.PLength = uint16(binary.Size(p))
err := binary.Write(buf, binary.LittleEndian, p)
logErrorDebug(err, "binary.Write")
enc := gob.NewEncoder(&buf)
p.PLength = uint16(len(p.Password) + len(p.AppName) + len(p.AppVersion) + 3)
err := enc.Encode(p)
logErrorDebug(err, "enc.Encode")
return buf.Bytes()
}