net: add an internal subnet for representing unresolved hostnames
commit7f31762cb6261806542cc6d1188ca07db98a6950
authorCory Fields <cory-nospam-@coryfields.com>
Wed, 24 May 2017 00:04:38 +0000 (23 20:04 -0400)
committerCory Fields <cory-nospam-@coryfields.com>
Wed, 14 Jun 2017 22:05:00 +0000 (14 18:05 -0400)
tree6ed637d6ebbb0a3d572b1dfa02bbd152fbae6c32
parentfbf5d3ba15161f71cbb84a51c1703c22b651e8a9
net: add an internal subnet for representing unresolved hostnames

We currently do two resolves for dns seeds: one for the results, and one to
serve in addrman as the source for those addresses.

There's no requirement that the source hostname resolves to the stored
identifier, only that the mapping is unique. So rather than incurring the
second lookup, combine a private subnet with a hash of the hostname.

The resulting v6 ip is guaranteed not to be publicy routable, and has only a
negligible chance of colliding with a user's internal network (which would be
of no consequence anyway).
src/net.cpp
src/netaddress.cpp
src/netaddress.h
src/rpc/net.cpp
src/test/netbase_tests.cpp