Don't send private ip addresses on pex

This commit is contained in:
shortcutme 2018-01-30 13:58:01 +01:00
parent a6f86329c5
commit c2edbb30b5
No known key found for this signature in database
GPG key ID: 5B63BAE6CB9613AE
5 changed files with 28 additions and 5 deletions

View file

@ -216,4 +216,8 @@ def avg(items):
if len(items) > 0:
return sum(items) / len(items)
else:
return 0
return 0
local_ip_pattern = re.compile(r"^(127\.)|(192\.168\.)|(10\.)|(172\.1[6-9]\.)|(172\.2[0-9]\.)|(172\.3[0-1]\.)|(::1$)|([fF][cCdD])")
def isPrivateIp(ip):
return local_ip_pattern.match(ip)