mirror of
https://github.com/hamburghammer/grcon.git
synced 2024-12-23 13:37:43 +01:00
Augusto Dwenger J
1cda9ca591
Initially it was the idea that this would be version 2 of the https://github.com/hamburghammer/rcon lib but I changed my mind and decided to make a new Project out of it. It has formally nothing to do with the original lib.
23 lines
643 B
Go
23 lines
643 B
Go
package util
|
|
|
|
import "github.com/hamburghammer/grcon"
|
|
|
|
// NewExecCommandPacket creates a new grcon.Packet with
|
|
// the correct Type and the given Id and command string as Body.
|
|
func NewExecCommandPacket(id int32, cmd string) grcon.Packet {
|
|
return grcon.Packet{
|
|
Id: grcon.PacketId(id),
|
|
Type: grcon.SERVERDATA_EXECCOMMAND,
|
|
Body: []byte(cmd),
|
|
}
|
|
}
|
|
|
|
// NewEmptyResponseValuePacket returns an empty response value Type packet
|
|
// with an empty Body and the given Id.
|
|
func NewEmptyResponseValuePacket(id int32) grcon.Packet {
|
|
return grcon.Packet{
|
|
Id: grcon.PacketId(id),
|
|
Type: grcon.SERVERDATA_RESPONSE_VALUE,
|
|
Body: []byte(""),
|
|
}
|
|
}
|