Commit e4433c79 authored by Georg Koppen's avatar Georg Koppen
Browse files

Merge remote-tracking branch 'gitlab/merge-requests/24' into maint-1.1

parents b9f92100 ca20d828
......@@ -181,6 +181,10 @@ class Relay:
"""
Returns True if the relay has an exit policy and the policy accepts
exiting to the given portself or False otherwise.
The exits that are IPv6 only or IPv4 but rejecting some public networks
will return false.
On July 2020, there were 67 out of 1095 exits like this.
"""
assert isinstance(port, int)
# if dind't get the descriptor, there isn't exit policy
......@@ -199,7 +203,12 @@ class Relay:
if self.exit_policy:
# Using `strict` to ensure it can exit to ALL domains
# and ips and that port. See #40006.
return self.exit_policy.can_exit_to(port=port, strict=True)
# Using `strip_private` to ignore reject rules to private
# networks.
return (
self.exit_policy.strip_private()
.can_exit_to(port=port, strict=True)
)
except TypeError:
return False
return False
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment