Browse Source

fix #197

tags/v1.2.0-rc1
Shivaram Lingamneni 4 years ago
parent
commit
f6eb8fa5a1
2 changed files with 5 additions and 7 deletions
  1. 2
    7
      irc/connection_limits/limiter.go
  2. 3
    0
      irc/gateways.go

+ 2
- 7
irc/connection_limits/limiter.go View File

58
 	cl.Lock()
58
 	cl.Lock()
59
 	defer cl.Unlock()
59
 	defer cl.Unlock()
60
 
60
 
61
-	if !cl.enabled {
62
-		return nil
63
-	}
64
-
65
-	// check exempted lists
66
 	// we don't track populations for exempted addresses or nets - this is by design
61
 	// we don't track populations for exempted addresses or nets - this is by design
67
-	if utils.IPInNets(addr, cl.exemptedNets) {
62
+	if !cl.enabled || utils.IPInNets(addr, cl.exemptedNets) {
68
 		return nil
63
 		return nil
69
 	}
64
 	}
70
 
65
 
85
 	cl.Lock()
80
 	cl.Lock()
86
 	defer cl.Unlock()
81
 	defer cl.Unlock()
87
 
82
 
88
-	if !cl.enabled {
83
+	if !cl.enabled || utils.IPInNets(addr, cl.exemptedNets) {
89
 		return
84
 		return
90
 	}
85
 	}
91
 
86
 

+ 3
- 0
irc/gateways.go View File

63
 	if isBanned {
63
 	if isBanned {
64
 		return errBanned, banMsg
64
 		return errBanned, banMsg
65
 	}
65
 	}
66
+	// successfully added a limiter entry for the proxied IP;
67
+	// remove the entry for the real IP if applicable (#197)
68
+	client.server.connectionLimiter.RemoveClient(session.realIP)
66
 
69
 
67
 	// given IP is sane! override the client's current IP
70
 	// given IP is sane! override the client's current IP
68
 	ipstring := parsedProxiedIP.String()
71
 	ipstring := parsedProxiedIP.String()

Loading…
Cancel
Save