test
This commit is contained in:
parent
330a7c6216
commit
6ddec0775c
13
def.go
13
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()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user