Skip to content

Commit

Permalink
fix #197
Browse files Browse the repository at this point in the history
  • Loading branch information
slingamn committed Sep 1, 2019
1 parent 8a33d68 commit f6eb8fa
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
9 changes: 2 additions & 7 deletions irc/connection_limits/limiter.go
Expand Up @@ -58,13 +58,8 @@ func (cl *Limiter) AddClient(addr net.IP, force bool) error {
cl.Lock()
defer cl.Unlock()

if !cl.enabled {
return nil
}

// check exempted lists
// we don't track populations for exempted addresses or nets - this is by design
if utils.IPInNets(addr, cl.exemptedNets) {
if !cl.enabled || utils.IPInNets(addr, cl.exemptedNets) {
return nil
}

Expand All @@ -85,7 +80,7 @@ func (cl *Limiter) RemoveClient(addr net.IP) {
cl.Lock()
defer cl.Unlock()

if !cl.enabled {
if !cl.enabled || utils.IPInNets(addr, cl.exemptedNets) {
return
}

Expand Down
3 changes: 3 additions & 0 deletions irc/gateways.go
Expand Up @@ -63,6 +63,9 @@ func (client *Client) ApplyProxiedIP(session *Session, proxiedIP string, tls boo
if isBanned {
return errBanned, banMsg
}
// successfully added a limiter entry for the proxied IP;
// remove the entry for the real IP if applicable (#197)
client.server.connectionLimiter.RemoveClient(session.realIP)

// given IP is sane! override the client's current IP
ipstring := parsedProxiedIP.String()
Expand Down

0 comments on commit f6eb8fa

Please sign in to comment.