test
This commit is contained in:
parent
f21b52aa01
commit
0e88fff5a3
6
main.go
6
main.go
@ -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)
|
||||||
}
|
}
|
||||||
|
11
packet.go
11
packet.go
@ -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)
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user