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() }