This commit is contained in:
shoopea 2020-06-14 16:45:07 +02:00
parent 231c1c5605
commit 5382f8dfa7

33
def.go
View File

@ -1,16 +1,8 @@
package main
type Packet struct {
PLength uint16
PType uint8
}
type PacketAdminJoin struct {
Packet
Password string
AppName string
AppVersion string
}
import (
"bytes"
)
const (
AdminPacketAdminJoin uint8 = 0
@ -50,3 +42,22 @@ const (
AdminPacketServerPong
InvalidAdminPacket = 0xFF
)
type Packet struct {
PLength uint16
PType uint8
}
type PacketAdminJoin struct {
Packet
Password string
AppName string
AppVersion string
}
func (p *PacketAdminJoin) Bytes() []byte {
buf := new(bytes.Buffer)
p.PLength = binary.Size(p)
_ = binary.Write(buf, binary.LittleEndian, p)
return buf.Bytes()
}