aboutsummaryrefslogtreecommitdiff
path: root/src/p2p
diff options
context:
space:
mode:
authorThomas Winget <tewinget@gmail.com>2014-09-17 15:35:52 -0400
committerRiccardo Spagni <ric@spagni.net>2014-09-23 22:58:07 +0200
commit578050e91d8fad8834a7c180a15824f5a46940f9 (patch)
treeca6c05a0ef75aa30f50b37fb62b7985919d8876b /src/p2p
parentUpdated CMake files -- added libunbound linker flag (diff)
downloadmonero-578050e91d8fad8834a7c180a15824f5a46940f9.tar.xz
ipv4 and ipv6 resolution working
IPv4 and IPv6 name resolution working. Unit tests written (and passing). net_node.{h,inl} code modified to use DNS seeds.
Diffstat (limited to 'src/p2p')
-rw-r--r--src/p2p/net_node.h7
-rw-r--r--src/p2p/net_node.inl38
2 files changed, 34 insertions, 11 deletions
diff --git a/src/p2p/net_node.h b/src/p2p/net_node.h
index 759b21fcf..53a13f327 100644
--- a/src/p2p/net_node.h
+++ b/src/p2p/net_node.h
@@ -112,6 +112,13 @@ namespace nodetool
size_t get_outgoing_connections_count();
peerlist_manager& get_peerlist_manager(){return m_peerlist;}
private:
+ const std::vector<std::string> m_seed_nodes_list =
+ { "seeds.moneroseeds.se"
+ , "seeds.moneroseeds.ae.org"
+ , "seeds.moneroseeds.ch"
+ , "seeds.moneroseeds.li"
+ };
+
typedef COMMAND_REQUEST_STAT_INFO_T<typename t_payload_net_handler::stat_info> COMMAND_REQUEST_STAT_INFO;
CHAIN_LEVIN_INVOKE_MAP2(p2p_connection_context); //move levin_commands_handler interface invoke(...) callbacks into invoke map
diff --git a/src/p2p/net_node.inl b/src/p2p/net_node.inl
index 954d794b7..60bc870e7 100644
--- a/src/p2p/net_node.inl
+++ b/src/p2p/net_node.inl
@@ -245,17 +245,33 @@ namespace nodetool
}
else
{
- add_hardcoded_seed_node(m_seed_nodes, "62.210.78.186:18080");
- add_hardcoded_seed_node(m_seed_nodes, "195.12.60.154:18080");
- add_hardcoded_seed_node(m_seed_nodes, "54.241.246.125:18080");
- add_hardcoded_seed_node(m_seed_nodes, "107.170.157.169:18080");
- add_hardcoded_seed_node(m_seed_nodes, "54.207.112.216:18080");
- add_hardcoded_seed_node(m_seed_nodes, "78.27.112.54:18080");
- add_hardcoded_seed_node(m_seed_nodes, "209.222.30.57:18080");
- add_hardcoded_seed_node(m_seed_nodes, "80.71.13.55:18080");
- add_hardcoded_seed_node(m_seed_nodes, "107.178.112.126:18080");
- add_hardcoded_seed_node(m_seed_nodes, "107.158.233.98:18080");
- add_hardcoded_seed_node(m_seed_nodes, "64.22.111.2:18080");
+ // for each hostname in the seed nodes list, attempt to DNS resolve and
+ // add the result addresses as seed nodes
+ // TODO: at some point add IPv6 support, but that won't be relevant
+ // for some time yet.
+ for (const std::string& addr_str : m_seed_nodes_list)
+ {
+ std::vector<std::string> addr_list = tools::DNSResolver::instance().get_ipv4(addr_str);
+ for (const std::string& a : addr_list)
+ {
+ append_net_address(m_seed_nodes, a + ":18080");
+ }
+ }
+
+ if (!m_seed_nodes.size())
+ {
+ add_hardcoded_seed_node(m_seed_nodes, "62.210.78.186:18080");
+ add_hardcoded_seed_node(m_seed_nodes, "195.12.60.154:18080");
+ add_hardcoded_seed_node(m_seed_nodes, "54.241.246.125:18080");
+ add_hardcoded_seed_node(m_seed_nodes, "107.170.157.169:18080");
+ add_hardcoded_seed_node(m_seed_nodes, "54.207.112.216:18080");
+ add_hardcoded_seed_node(m_seed_nodes, "78.27.112.54:18080");
+ add_hardcoded_seed_node(m_seed_nodes, "209.222.30.57:18080");
+ add_hardcoded_seed_node(m_seed_nodes, "80.71.13.55:18080");
+ add_hardcoded_seed_node(m_seed_nodes, "107.178.112.126:18080");
+ add_hardcoded_seed_node(m_seed_nodes, "107.158.233.98:18080");
+ add_hardcoded_seed_node(m_seed_nodes, "64.22.111.2:18080");
+ }
}
bool res = handle_command_line(vm, testnet);