mirror of
https://github.com/onyx-and-iris/q3rcon.git
synced 2026-04-18 07:43:31 +00:00
remove internal packages, move everything into q3rcon
{request}.buf initialised with 0 length.
encoder, decoder interfaces added.
This commit is contained in:
21
response.go
Normal file
21
response.go
Normal file
@@ -0,0 +1,21 @@
|
||||
package q3rcon
|
||||
|
||||
import "bytes"
|
||||
|
||||
const (
|
||||
responseHeader = "\xff\xff\xff\xffprint\n"
|
||||
)
|
||||
|
||||
type response struct{}
|
||||
|
||||
func newResponse() response {
|
||||
return response{}
|
||||
}
|
||||
|
||||
func (r response) IsValid(buf []byte) bool {
|
||||
return len(buf) > len(responseHeader) && bytes.HasPrefix(buf, []byte(responseHeader))
|
||||
}
|
||||
|
||||
func (r response) Decode(buf []byte) string {
|
||||
return string(buf[len(responseHeader):])
|
||||
}
|
||||
Reference in New Issue
Block a user