aboutsummaryrefslogtreecommitdiff
path: root/src/p2p/net_node.inl
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/net_node.inl
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/net_node.inl')
-rw-r--r--src/p2p/net_node.inl38
1 files changed, 27 insertions, 11 deletions
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);