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