aboutsummaryrefslogtreecommitdiff
path: root/contrib/epee/src/net_utils_base.cpp
diff options
context:
space:
mode:
authorLee Clagett <code@leeclagett.com>2018-12-16 17:57:44 +0000
committerLee Clagett <code@leeclagett.com>2019-01-28 23:56:33 +0000
commit973403bc9f54ab0722b67a3c76ab6e7bafbfeedc (patch)
tree01f74938dc99a56c5d20840baa9bce66142847ae /contrib/epee/src/net_utils_base.cpp
parentMerge pull request #5062 (diff)
downloadmonero-973403bc9f54ab0722b67a3c76ab6e7bafbfeedc.tar.xz
Adding initial support for broadcasting transactions over Tor
- Support for ".onion" in --add-exclusive-node and --add-peer - Add --anonymizing-proxy for outbound Tor connections - Add --anonymous-inbounds for inbound Tor connections - Support for sharing ".onion" addresses over Tor connections - Support for broadcasting transactions received over RPC exclusively over Tor (else broadcast over public IP when Tor not enabled).
Diffstat (limited to '')
-rw-r--r--contrib/epee/src/net_utils_base.cpp42
1 files changed, 26 insertions, 16 deletions
diff --git a/contrib/epee/src/net_utils_base.cpp b/contrib/epee/src/net_utils_base.cpp
index 263b344b4..9b781027e 100644
--- a/contrib/epee/src/net_utils_base.cpp
+++ b/contrib/epee/src/net_utils_base.cpp
@@ -8,8 +8,6 @@
namespace epee { namespace net_utils
{
- const uint8_t ipv4_network_address::ID;
-
bool ipv4_network_address::equal(const ipv4_network_address& other) const noexcept
{ return is_same_host(other) && port() == other.port(); }
@@ -58,20 +56,6 @@ namespace epee { namespace net_utils
return self_->is_same_host(*other_self);
}
- bool create_network_address(network_address &address, const std::string &string, uint16_t default_port)
- {
- uint32_t ip;
- uint16_t port;
- if (epee::string_tools::parse_peer_from_string(ip, port, string))
- {
- if (default_port && !port)
- port = default_port;
- address = ipv4_network_address{ip, port};
- return true;
- }
- return false;
- }
-
std::string print_connection_context(const connection_context_base& ctx)
{
std::stringstream ss;
@@ -86,5 +70,31 @@ namespace epee { namespace net_utils
return ss.str();
}
+ const char* zone_to_string(zone value) noexcept
+ {
+ switch (value)
+ {
+ case zone::public_:
+ return "public";
+ case zone::i2p:
+ return "i2p";
+ case zone::tor:
+ return "tor";
+ default:
+ break;
+ }
+ return "invalid";
+ }
+
+ zone zone_from_string(const boost::string_ref value) noexcept
+ {
+ if (value == "public")
+ return zone::public_;
+ if (value == "i2p")
+ return zone::i2p;
+ if (value == "tor")
+ return zone::tor;
+ return zone::invalid;
+ }
}}