From: rexxnor Date: Thu, 30 Jan 2020 09:48:04 +0000 (+0100) Subject: added testing scripts for dns2gns X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=015cd279bf43981c9edae0d0b2802d6237d172b8;p=oweals%2Fgnunet.git added testing scripts for dns2gns --- diff --git a/src/gns/test_dns2gns.conf b/src/gns/test_dns2gns.conf new file mode 100644 index 000000000..3b034f8d5 --- /dev/null +++ b/src/gns/test_dns2gns.conf @@ -0,0 +1,68 @@ +@INLINE@ test_gns_defaults.conf + +[namecache] +DISABLE = YES + +[PATHS] +GNUNET_TEST_HOME = $GNUNET_TMP/test-gnunet-gns-peer-1/ + +[dht] +START_ON_DEMAND = YES +IMMEDIATE_START = YES + +[gns] +# PREFIX = valgrind --leak-check=full --track-origins=yes +START_ON_DEMAND = YES +AUTO_IMPORT_PKEY = YES +MAX_PARALLEL_BACKGROUND_QUERIES = 10 +DEFAULT_LOOKUP_TIMEOUT = 15 s +RECORD_PUT_INTERVAL = 1 h +ZONE_PUBLISH_TIME_WINDOW = 1 h +DNS_ROOT=PD67SGHF3E0447TU9HADIVU9OM7V4QHTOG0EBU69TFRI2LG63DR0 + +[namestore] +IMMEDIATE_START = YES +#PREFIX = valgrind --leak-check=full --track-origins=yes --log-file=/tmp/ns_log + +[revocation] +WORKBITS = 1 + +[dhtcache] +QUOTA = 1 MB +DATABASE = heap + +[topology] +TARGET-CONNECTION-COUNT = 16 +AUTOCONNECT = YES +FRIENDS-ONLY = NO +MINIMUM-FRIENDS = 0 + +[ats] +WAN_QUOTA_IN = 1 GB +WAN_QUOTA_OUT = 1 GB + +[transport] +plugins = tcp +NEIGHBOUR_LIMIT = 50 +PORT = 2091 + +[transport-tcp] +TIMEOUT = 300 s + +[nat] +DISABLEV6 = YES +BINDTO = 127.0.0.1 +ENABLE_UPNP = NO +BEHIND_NAT = NO +ALLOW_NAT = NO +INTERNAL_ADDRESS = 127.0.0.1 +EXTERNAL_ADDRESS = 127.0.0.1 + +[dns2gns] +BINARY = gnunet-dns2gns +START_ON_DEMAND = YES +IMMEDIATE_START = YES +RUN_PER_USER = YES +BIND_TO = 127.0.0.1 +BIND_TO6 = ::1 +OPTIONS = -d 1.1.1.1 -p 12000 diff --git a/src/gns/test_dns2gns.sh b/src/gns/test_dns2gns.sh new file mode 100644 index 000000000..295bcc766 --- /dev/null +++ b/src/gns/test_dns2gns.sh @@ -0,0 +1,50 @@ +#!/bin/bash +# This file is in the public domain. +trap "gnunet-arm -e -c test_dns2gns.conf" INT +which timeout > /dev/null 2>&1 && DO_TIMEOUT="timeout 30" + +LOCATION=$(which gnunet-config) +if [ -z $LOCATION ] +then + LOCATION="gnunet-config" +fi +$LOCATION --version 1> /dev/null +if test $? != 0 +then + echo "GNUnet command line tools cannot be found, check environmental variables PATH and GNUNET_PREFIX" + exit 77 +fi + +rm -rf `gnunet-config -c test_dns2gns.conf -f -s paths -o GNUNET_TEST_HOME` +MY_EGO="localego" +TEST_IP="127.0.0.1" +TEST_IPV6="dead::beef" +LABEL="fnord" +TEST_DOMAIN="gnunet.org" + +gnunet-arm -s -c test_dns2gns.conf +PKEY=`gnunet-identity -V -C $MY_EGO -c test_dns2gns.conf` +gnunet-namestore -p -z $MY_EGO -a -n $LABEL -t A -V $TEST_IP -e 3600s -c test_dns2gns.conf +gnunet-namestore -p -z $MY_EGO -a -n $LABEL -t AAAA -V $TEST_IPV6 -e 3600s -c test_dns2gns.conf + +# FIXME resolution works but always returns all available records +# also, the records seem to be returned twice if using GNS + +if nslookup -port=12000 $LABEL.$PKEY localhost && nslookup -port=12000 $LABEL.$MY_EGO localhost; then + echo "PASS: GNS records can be resolved using dns2gns bridge" +else + echo "FAIL: GNS records can't be resolved using dns2gns bridge" + rm -rf `gnunet-config -c test_dns2gns.conf -f -s paths -o GNUNET_TEST_HOME` + exit 1 +fi + +if nslookup -port=12000 gnunet.org localhost; then + echo "PASS: DNS records can be resolved using dns2gns bridge" +else + echo "FAIL: DNS records can't be resolved using dns2gns bridge" + rm -rf `gnunet-config -c test_dns2gns.conf -f -s paths -o GNUNET_TEST_HOME` + exit 1 +fi +gnunet-arm -e -c test_dns2gns.conf + +rm -rf `gnunet-config -c test_dns2gns.conf -f -s paths -o GNUNET_TEST_HOME`