test
This commit is contained in:
parent
33a55bf92d
commit
1b25deb818
15
def.go
15
def.go
@ -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()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user