log bad rcon requests at info level

include client ip in log
This commit is contained in:
onyx-and-iris 2024-04-03 20:54:10 +01:00
parent 0c054377ba
commit 3e039824de
2 changed files with 9 additions and 1 deletions

View File

@ -64,7 +64,11 @@ func (s *session) proxyFrom(buf []byte) error {
} }
if s.isRconResponsePacket(buf) { if s.isRconResponsePacket(buf) {
log.Debugf("Response: %s", string(buf[10:])) if s.isBadRconRequest(buf) {
log.Infof("Response: Bad rcon from %s", s.caddr.IP)
} else {
log.Debugf("Response: %s", string(buf[10:]))
}
} }
return nil return nil

View File

@ -26,3 +26,7 @@ func (v *validator) isQueryResponsePacket(buf []byte) bool {
func (v *validator) isValidResponsePacket(buf []byte) bool { func (v *validator) isValidResponsePacket(buf []byte) bool {
return v.isRconResponsePacket(buf) || v.isQueryResponsePacket(buf) return v.isRconResponsePacket(buf) || v.isQueryResponsePacket(buf)
} }
func (v *validator) isBadRconRequest(buf []byte) bool {
return string(buf[10:18]) == "Bad rcon"
}