Navigation Menu

Skip to content

Commit

Permalink
Allow banning by server hostname
Browse files Browse the repository at this point in the history
  • Loading branch information
sfan5 committed May 14, 2017
1 parent 705ea6e commit 828a1fd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions config-example.py
Expand Up @@ -17,8 +17,8 @@
# e.g. ['2620:101::44']
BANNED_IPS = []

# List of banned servers as IP/port pairs
# e.g. ['1.2.3.4/30000']
# List of banned servers as host/port pairs
# e.g. ['1.2.3.4/30000', 'evil.server.ua/30001']
BANNED_SERVERS = []

# Creates server entries if a server sends an 'update' and there is no entry yet.
Expand Down
2 changes: 2 additions & 0 deletions server.py
Expand Up @@ -77,6 +77,8 @@ def announce():

if "%s/%d" % (server["ip"], server["port"]) in app.config["BANNED_SERVERS"]:
return "Banned (Server).", 403
elif "address" in server and "%s/%d" % (server["address"], server["port"]) in app.config["BANNED_SERVERS"]:
return "Banned (Server).", 403

old = serverList.get(ip, server["port"])

Expand Down

0 comments on commit 828a1fd

Please sign in to comment.