diff options
author | Pieter Wuille <pieter.wuille@gmail.com> | 2012-04-29 02:11:56 +0200 |
---|---|---|
committer | Pieter Wuille <pieter.wuille@gmail.com> | 2012-06-23 01:11:32 +0200 |
commit | 70f7f0038592a28e846f02d084f0119fc34eb52f (patch) | |
tree | 7439cec074260c4eee55026c5a9ab37e0bcf6f58 /src/test | |
parent | e0be8da3924031ea115c93551dfa463f84d3a120 (diff) |
Node support for Tor hidden services
This commit adds support for .onion addresses (mapped into the IPv6
by using OnionCat's range and encoding), and the ability to connect
to them via a SOCKS5 proxy.
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/base32_tests.cpp | 2 | ||||
-rw-r--r-- | src/test/netbase_tests.cpp | 13 |
2 files changed, 13 insertions, 2 deletions
diff --git a/src/test/base32_tests.cpp b/src/test/base32_tests.cpp index 756c72b94d..fdf3285913 100644 --- a/src/test/base32_tests.cpp +++ b/src/test/base32_tests.cpp @@ -7,7 +7,7 @@ BOOST_AUTO_TEST_SUITE(base32_tests) BOOST_AUTO_TEST_CASE(base32_testvectors) { static const std::string vstrIn[] = {"","f","fo","foo","foob","fooba","foobar"}; - static const std::string vstrOut[] = {"","MY======","MZXQ====","MZXW6===","MZXW6YQ=","MZXW6YTB","MZXW6YTBOI======"}; + static const std::string vstrOut[] = {"","my======","mzxq====","mzxw6===","mzxw6yq=","mzxw6ytb","mzxw6ytboi======"}; for (unsigned int i=0; i<sizeof(vstrIn)/sizeof(vstrIn[0]); i++) { std::string strEnc = EncodeBase32(vstrIn[i]); diff --git a/src/test/netbase_tests.cpp b/src/test/netbase_tests.cpp index f0828f39fc..e5a7562d97 100644 --- a/src/test/netbase_tests.cpp +++ b/src/test/netbase_tests.cpp @@ -34,7 +34,7 @@ BOOST_AUTO_TEST_CASE(netbase_properties) BOOST_CHECK(CNetAddr("2001:10::").IsRFC4843()); BOOST_CHECK(CNetAddr("FE80::").IsRFC4862()); BOOST_CHECK(CNetAddr("64:FF9B::").IsRFC6052()); - BOOST_CHECK(CNetAddr("FD87:D87E:EB43:edb1:8e4:3588:e546:35ca").IsOnionCat()); + BOOST_CHECK(CNetAddr("FD87:D87E:EB43:edb1:8e4:3588:e546:35ca").IsTor()); BOOST_CHECK(CNetAddr("127.0.0.1").IsLocal()); BOOST_CHECK(CNetAddr("::1").IsLocal()); BOOST_CHECK(CNetAddr("8.8.8.8").IsRoutable()); @@ -88,4 +88,15 @@ BOOST_AUTO_TEST_CASE(netbase_lookupnumeric) BOOST_CHECK(TestParse(":::", "")); } +BOOST_AUTO_TEST_CASE(onioncat_test) +{ + // values from http://www.cypherpunk.at/onioncat/wiki/OnionCat + CNetAddr addr1("5wyqrzbvrdsumnok.onion"); + CNetAddr addr2("FD87:D87E:EB43:edb1:8e4:3588:e546:35ca"); + BOOST_CHECK(addr1 == addr2); + BOOST_CHECK(addr1.IsTor()); + BOOST_CHECK(addr1.ToStringIP() == "5wyqrzbvrdsumnok.onion"); + BOOST_CHECK(addr1.IsRoutable()); +} + BOOST_AUTO_TEST_SUITE_END() |