diff options
author | luigi1111 <luigi1111w@gmail.com> | 2023-01-11 11:40:13 -0500 |
---|---|---|
committer | luigi1111 <luigi1111w@gmail.com> | 2023-01-11 11:40:13 -0500 |
commit | cbc5cf43f2e40940f6a3e42b9d833753305baf35 (patch) | |
tree | f323badb0cfd659a4250e9457c2862abeb782430 /src/net/parse.cpp | |
parent | Merge pull request #8641 (diff) | |
parent | p2p: fix exclusive node DNS resolution for certain hosts [release] (diff) | |
download | monero-cbc5cf43f2e40940f6a3e42b9d833753305baf35.tar.xz |
Merge pull request #8644
38d4811 p2p: fix exclusive node DNS resolution for certain hosts [release] (Jeffrey Ryan)
Diffstat (limited to 'src/net/parse.cpp')
-rw-r--r-- | src/net/parse.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/net/parse.cpp b/src/net/parse.cpp index 1df6175b4..92be492a3 100644 --- a/src/net/parse.cpp +++ b/src/net/parse.cpp @@ -38,7 +38,7 @@ namespace net { void get_network_address_host_and_port(const std::string& address, std::string& host, std::string& port) { - // require ipv6 address format "[addr:addr:addr:...:addr]:port" + // If IPv6 address format with port "[addr:addr:addr:...:addr]:port" if (address.find(']') != std::string::npos) { host = address.substr(1, address.rfind(']') - 1); @@ -47,6 +47,12 @@ namespace net port = address.substr(address.rfind(':') + 1); } } + // Else if IPv6 address format without port e.g. "addr:addr:addr:...:addr" + else if (std::count(address.begin(), address.end(), ':') >= 2) + { + host = address; + } + // Else IPv4, Tor, I2P address or hostname else { host = address.substr(0, address.rfind(':')); |