aboutsummaryrefslogtreecommitdiff
path: root/src/common/util.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/common/util.cpp')
-rw-r--r--src/common/util.cpp17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/common/util.cpp b/src/common/util.cpp
index 433cb4919..445a11a75 100644
--- a/src/common/util.cpp
+++ b/src/common/util.cpp
@@ -871,10 +871,19 @@ std::string get_nix_version_display_string()
return max_concurrency;
}
+ bool is_privacy_preserving_network(const std::string &address)
+ {
+ if (boost::ends_with(address, ".onion"))
+ return true;
+ if (boost::ends_with(address, ".i2p"))
+ return true;
+ return false;
+ }
+
bool is_local_address(const std::string &address)
{
// always assume Tor/I2P addresses to be untrusted by default
- if (boost::ends_with(address, ".onion") || boost::ends_with(address, ".i2p"))
+ if (is_privacy_preserving_network(address))
{
MDEBUG("Address '" << address << "' is Tor/I2P, non local");
return false;
@@ -1000,13 +1009,13 @@ std::string get_nix_version_display_string()
for (char c: val)
{
if (c == '*')
- newval += escape ? "*" : ".*";
+ newval += escape ? "*" : ".*", escape = false;
else if (c == '?')
- newval += escape ? "?" : ".";
+ newval += escape ? "?" : ".", escape = false;
else if (c == '\\')
newval += '\\', escape = !escape;
else
- newval += c;
+ newval += c, escape = false;
}
return newval;
}