From 6ddec0775c6596495ac88ae02bfd78147fcd3672 Mon Sep 17 00:00:00 2001 From: shoopea Date: Sun, 14 Jun 2020 17:23:07 +0200 Subject: [PATCH] test --- def.go | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/def.go b/def.go index 16a879f..951ddec 100644 --- a/def.go +++ b/def.go @@ -2,7 +2,7 @@ package main import ( "bytes" - "encoding/gob" + "encoding/binary" ) const ( @@ -58,12 +58,13 @@ type PacketAdminJoin struct { func (p *PacketAdminJoin) Bytes() []byte { buf := new(bytes.Buffer) - enc := gob.NewEncoder(buf) - buf.Reset() - p.PLength = uint16(len(p.Password) + len(p.AppName) + len(p.AppVersion) + 3) - err := enc.Encode(p) - logErrorDebug(err, "enc.Encode") + + buf.WriteByte(p.PLength) + buf.WriteByte(p.PType) + buf.WriteString(p.Password) + buf.WriteString(p.AppName) + buf.WriteString(p.AppVersion) return buf.Bytes() }