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 {
|
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()
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user