summaryrefslogtreecommitdiff
path: root/selftest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'selftest.cpp')
-rw-r--r--selftest.cpp25
1 files changed, 21 insertions, 4 deletions
diff --git a/selftest.cpp b/selftest.cpp
index 5d5067fd..a0b3c951 100644
--- a/selftest.cpp
+++ b/selftest.cpp
@@ -55,6 +55,7 @@
#include "osdep/OSUtils.hpp"
#include "osdep/Phy.hpp"
#include "osdep/Http.hpp"
+#include "osdep/BackgroundResolver.hpp"
#ifdef ZT_ENABLE_NETWORK_CONTROLLER
#include "controller/SqliteNetworkController.hpp"
@@ -510,16 +511,14 @@ static int testCertificate()
static int testPacket()
{
- unsigned char salsaKey[32],hmacKey[32];
+ unsigned char salsaKey[32];
Packet a,b;
a.burn();
b.burn();
- for(unsigned int i=0;i<32;++i) {
+ for(unsigned int i=0;i<32;++i)
salsaKey[i] = (unsigned char)rand();
- hmacKey[i] = (unsigned char)rand();
- }
std::cout << "[packet] Testing Packet encoder/decoder... ";
@@ -771,6 +770,23 @@ static int testSqliteNetworkController()
return 0;
}
+static int testResolver()
+{
+ std::cout << "[resolver] Testing BackgroundResolver..."; std::cout.flush();
+
+ BackgroundResolver r("tcp-fallback.zerotier.com");
+ r.resolveNow();
+ r.wait();
+
+ std::vector<InetAddress> ips(r.get());
+ for(std::vector<InetAddress>::const_iterator ip(ips.begin());ip!=ips.end();++ip) {
+ std::cout << ' ' << ip->toString();
+ }
+ std::cout << std::endl;
+
+ return 0;
+}
+
static int testHttp()
{
std::map<std::string,std::string> requestHeaders,responseHeaders;
@@ -875,6 +891,7 @@ int main(int argc,char **argv)
r |= testIdentity();
r |= testCertificate();
r |= testPhy();
+ r |= testResolver();
r |= testHttp();
if (r)