This commit is contained in:
shoopea 2020-06-15 15:07:52 +02:00
parent f21b52aa01
commit 0e88fff5a3
2 changed files with 17 additions and 0 deletions

View File

@ -153,6 +153,12 @@ func main() {
} }
sp.Read(b[:p.PLength]) sp.Read(b[:p.PLength])
logInfoDebug("AdminPacketServerConsole :\n- Origin: %s\n- Text: %s", sp.Origin, sp.Text) logInfoDebug("AdminPacketServerConsole :\n- Origin: %s\n- Text: %s", sp.Origin, sp.Text)
case AdminPacketServerRConEnd:
sp := PacketServerRConEnd{
Packet: p,
}
sp.Read(b[:p.PLength])
logInfoDebug("AdminPacketServerRConEnd :\n- Command: %s", sp.Command)
default: default:
logInfoDebug("Packet fully read : len : %d / type : %d", p.PLength, p.PType) logInfoDebug("Packet fully read : len : %d / type : %d", p.PLength, p.PType)
} }

View File

@ -161,6 +161,11 @@ type PacketServerRCon struct {
Output string Output string
} }
type PacketServerRConEnd struct {
Packet
Command string
}
func (p *PacketAdminJoin) Bytes() []byte { func (p *PacketAdminJoin) Bytes() []byte {
buf := new(bytes.Buffer) buf := new(bytes.Buffer)
p.PLength = uint16(len(p.Password) + len(p.AppName) + len(p.AppVersion) + 6) p.PLength = uint16(len(p.Password) + len(p.AppName) + len(p.AppVersion) + 6)
@ -324,3 +329,9 @@ func (p *PacketServerRCon) Read(b []byte) {
p.ColorID = binary.LittleEndian.Uint16(bs[0:]) p.ColorID = binary.LittleEndian.Uint16(bs[0:])
p.Output, _ = r.ReadString(0) p.Output, _ = r.ReadString(0)
} }
func (p *PacketServerRConEnd) Read(b []byte) {
r := bufio.NewReader(bytes.NewReader(b))
r.Discard(3)
p.Command, _ = r.ReadString(0)
}