aboutsummaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/common/util.cpp11
-rw-r--r--src/common/util.h1
2 files changed, 11 insertions, 1 deletions
diff --git a/src/common/util.cpp b/src/common/util.cpp
index f8707d65c..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;
diff --git a/src/common/util.h b/src/common/util.h
index 0c3409ea1..6366e5cb4 100644
--- a/src/common/util.h
+++ b/src/common/util.h
@@ -228,6 +228,7 @@ namespace tools
unsigned get_max_concurrency();
bool is_local_address(const std::string &address);
+ bool is_privacy_preserving_network(const std::string &address);
int vercmp(const char *v0, const char *v1); // returns < 0, 0, > 0, similar to strcmp, but more human friendly than lexical - does not attempt to validate
bool sha256sum(const uint8_t *data, size_t len, crypto::hash &hash);