mirror of
https://github.com/ergochat/ergo.git
synced 2024-11-10 22:19:31 +01:00
fix #197
This commit is contained in:
parent
8a33d68cf1
commit
f6eb8fa5a1
@ -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
|
||||
}
|
||||
|
||||
@ -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
|
||||
}
|
||||
|
||||
|
@ -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()
|
||||
|
Loading…
Reference in New Issue
Block a user