|
|
|
@ -7,7 +7,7 @@ class Filter:
@@ -7,7 +7,7 @@ class Filter:
|
|
|
|
|
|
|
|
|
|
def process(self, info): |
|
|
|
|
""" |
|
|
|
|
process an info and return True if it should be added to blocklist |
|
|
|
|
process an info and return a string representation of a reason to add to blocklist |
|
|
|
|
any other return value will cause this info to NOT be added to blocklist |
|
|
|
|
""" |
|
|
|
|
|
|
|
|
@ -22,11 +22,12 @@ class FloodfillFilter(Filter):
@@ -22,11 +22,12 @@ class FloodfillFilter(Filter):
|
|
|
|
|
def process(self, info): |
|
|
|
|
caps = util.getcaps(info) |
|
|
|
|
if not caps: |
|
|
|
|
return False |
|
|
|
|
return |
|
|
|
|
if b'f' not in caps: |
|
|
|
|
return False |
|
|
|
|
return |
|
|
|
|
h = util.getaddress(info) |
|
|
|
|
if h not in self._floodfills: |
|
|
|
|
self._floodfills[h] = 0 |
|
|
|
|
self._floodfills[h] += 1 |
|
|
|
|
return self._floodfills[h] > self.fmax |
|
|
|
|
if self._floodfills[h] > self.fmax: |
|
|
|
|
return '{} > {} floodfills per ip'.format(self._floodfills[h], self.fmax) |
|
|
|
|