aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorluigi1111 <luigi1111w@gmail.com>2023-08-17 10:11:12 -0500
committerluigi1111 <luigi1111w@gmail.com>2023-08-17 10:11:12 -0500
commit4cabfe7aba43af7bfd19fb038262809be0fc8a02 (patch)
tree5c4456c114c4a7fe401bdd34a2aebb7646aac7cd /src
parentMerge pull request #8840 (diff)
parentnet: tor_address: remove support for v2 onion addresses (diff)
downloadmonero-4cabfe7aba43af7bfd19fb038262809be0fc8a02.tar.xz
Merge pull request #8853
6ff87ef net: tor_address: remove support for v2 onion addresses (tobtoht)
Diffstat (limited to 'src')
-rw-r--r--src/net/tor_address.cpp5
-rw-r--r--src/net/tor_address.h2
2 files changed, 2 insertions, 5 deletions
diff --git a/src/net/tor_address.cpp b/src/net/tor_address.cpp
index 53b73a839..ad8b399c8 100644
--- a/src/net/tor_address.cpp
+++ b/src/net/tor_address.cpp
@@ -48,7 +48,6 @@ namespace net
constexpr const char tld[] = u8".onion";
constexpr const char unknown_host[] = "<unknown tor host>";
- constexpr const unsigned v2_length = 16;
constexpr const unsigned v3_length = 56;
constexpr const char base32_alphabet[] =
@@ -62,7 +61,7 @@ namespace net
host.remove_suffix(sizeof(tld) - 1);
//! \TODO v3 has checksum, base32 decoding is required to verify it
- if (host.size() != v2_length && host.size() != v3_length)
+ if (host.size() != v3_length)
return {net::error::invalid_tor_address};
if (host.find_first_not_of(base32_alphabet) != boost::string_ref::npos)
return {net::error::invalid_tor_address};
@@ -118,7 +117,6 @@ namespace net
if (!port.empty() && !epee::string_tools::get_xtype_from_string(porti, std::string{port}))
return {net::error::invalid_port};
- static_assert(v2_length <= v3_length, "bad internal host size");
static_assert(v3_length + sizeof(tld) == sizeof(tor_address::host_), "bad internal host size");
return tor_address{host, porti};
}
@@ -180,7 +178,6 @@ namespace net
bool tor_address::is_same_host(const tor_address& rhs) const noexcept
{
- //! \TODO v2 and v3 should be comparable - requires base32
return std::strcmp(host_str(), rhs.host_str()) == 0;
}
diff --git a/src/net/tor_address.h b/src/net/tor_address.h
index 3dd320b5d..d04bf5145 100644
--- a/src/net/tor_address.h
+++ b/src/net/tor_address.h
@@ -71,7 +71,7 @@ namespace net
static tor_address unknown() noexcept { return tor_address{}; }
/*!
- Parse `address` in onion v2 or v3 format with (i.e. x.onion:80)
+ Parse `address` in onion v3 format with (i.e. x.onion:80)
with `default_port` being used iff port is not specified in
`address`.
*/