restrict public node checks a little

do not include blocked hosts in peer lists or public node lists by default,
warn about no https on clearnet and about untrusted peers likely being spies
This commit is contained in:
moneromooo-monero 2020-12-20 12:48:34 +00:00
parent 3bd6ed94d7
commit d2fda6c25f
No known key found for this signature in database
GPG key ID: 686F07454D6CEFC3
7 changed files with 68 additions and 11 deletions

View file

@ -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;

View file

@ -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);