mirror of
https://github.com/onyx-and-iris/q3rcon-proxy.git
synced 2026-04-20 05:53:32 +00:00
Compare commits
3 Commits
v1.0.1
...
2c8ae43303
| Author | SHA1 | Date | |
|---|---|---|---|
| 2c8ae43303 | |||
| 0935fc1190 | |||
| 3e039824de |
@@ -64,7 +64,11 @@ func (s *session) proxyFrom(buf []byte) error {
|
||||
}
|
||||
|
||||
if s.isRconResponsePacket(buf) {
|
||||
log.Debugf("Response: %s", string(buf[10:]))
|
||||
if s.isBadRconResponse(buf) {
|
||||
log.Infof("Response: Bad rcon from %s", s.caddr.IP)
|
||||
} else {
|
||||
log.Debugf("Response: %s", string(buf[10:]))
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
@@ -85,8 +89,8 @@ func (s *session) proxyTo(buf []byte) error {
|
||||
}
|
||||
|
||||
if s.isRconRequestPacket(buf) {
|
||||
parts := strings.Split(string(buf), " ")
|
||||
log.Infof("From [%s] To [%s] Command: %s", s.caddr.IP, s.serverConn.RemoteAddr(), strings.Join(parts[2:], " "))
|
||||
parts := strings.SplitN(string(buf), " ", 3)
|
||||
log.Infof("From [%s] To [%s] Command: %s", s.caddr.IP, s.serverConn.RemoteAddr(), parts[len(parts)-1])
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
@@ -26,3 +26,7 @@ func (v *validator) isQueryResponsePacket(buf []byte) bool {
|
||||
func (v *validator) isValidResponsePacket(buf []byte) bool {
|
||||
return v.isRconResponsePacket(buf) || v.isQueryResponsePacket(buf)
|
||||
}
|
||||
|
||||
func (v *validator) isBadRconResponse(buf []byte) bool {
|
||||
return string(buf[10:18]) == "Bad rcon"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user