Add Broker Allowed Relay Pattern Indication Rejection for Proxy

This commit is contained in:
Shelikhoo 2022-04-14 11:15:35 +01:00
parent 2ebdc89c42
commit b18a9431b2
No known key found for this signature in database
GPG key ID: C4D5E79D22B25316
2 changed files with 22 additions and 7 deletions

View file

@ -67,12 +67,14 @@ func (i *IPC) Debug(_ interface{}, response *string) error {
func (i *IPC) ProxyPolls(arg messages.Arg, response *[]byte) error {
sid, proxyType, natType, clients, relayPattern, relayPatternSupported, err := messages.DecodeProxyPollRequestWithRelayPrefix(arg.Body)
_ = relayPattern
_ = relayPatternSupported
if err != nil {
return messages.ErrBadRequest
}
if !i.ctx.CheckProxyRelayPattern(relayPattern, !relayPatternSupported) {
return fmt.Errorf("bad request: rejected relay pattern from proxy = %v", messages.ErrBadRequest)
}
// Log geoip stats
remoteIP, _, err := net.SplitHostPort(arg.RemoteAddr)
if err != nil {