2 # This file is in the public domain.
3 trap "gnunet-arm -e -c test_gns_lookup.conf" INT
4 LOCATION=$(which gnunet-config)
7 LOCATION="gnunet-config"
9 $LOCATION --version 1> /dev/null
12 echo "GNUnet command line tools cannot be found, check environmental variables PATH and GNUNET_PREFIX"
16 rm -rf `gnunet-config -c test_gns_lookup.conf -f -s paths -o GNUNET_TEST_HOME`
18 gns_link="http://localhost:7776/gns"
19 wrong_link="http://localhost:7776/gnsandmore"
24 XURL=`which gnurl || which curl`
25 echo "Using $XURL to download $1"
26 cache="$(${XURL} -v "$1" 2>&1 | grep "$2")"
30 gnunet-identity -D "$TEST_TLD" -c test_gns_lookup.conf > /dev/null 2>&1
31 gnunet-arm -e -c test_gns_lookup.conf
32 echo "HTTP client (curl/gnurl) not found, exiting"
38 gnunet-arm -s -c test_gns_lookup.conf
39 curl_get "$gns_link/www.$TEST_TLD" "error"
41 gnunet-identity -C "$TEST_TLD" -c test_gns_lookup.conf
43 curl_get "$gns_link/www.$TEST_TLD" "\[\]"
45 gnunet-namestore -z "$TEST_TLD" -p -a -n www -e 1d -V 1.1.1.1 -t A -c test_gns_lookup.conf
47 curl_get "$gns_link/www.$TEST_TLD" "1.1.1.1"
49 gnunet-namestore -z "$TEST_TLD" -p -a -n www -e 1d -V 1::1 -t AAAA -c test_gns_lookup.conf
51 curl_get "$gns_link/www.$TEST_TLD" "1::1.*1.1.1.1"
53 gnunet-namestore -z "$TEST_TLD" -p -a -n www -e 1d -V 1.1.1.2 -t A -c test_gns_lookup.conf
55 curl_get "$gns_link/www.$TEST_TLD" "1.1.1.2.*1::1.*1.1.1.1"
56 curl_get "$gns_link/www.$TEST_TLD?record_type=A" "1.1.1.2.*1.1.1.1"
57 curl_get "$gns_link/www.$TEST_TLD?record_type=AAAA" "1::1"
58 curl_get "$gns_link/www.$TEST_TLD?record_type=WRONG_TYPE" "1.1.1.2.*1::1.*1.1.1.1"
60 gnunet-namestore -z "$TEST_TLD" -p -a -n www1 -e 1d -V 1.1.1.1 -t A -c test_gns_lookup.conf
61 curl_get "$gns_link/www1.$TEST_TLD" "1.1.1.1"
63 gnunet-namestore -z "$TEST_TLD" -d -n www1 -c test_gns_lookup.conf
64 gnunet-namestore -z "$TEST_TLD" -d -n www -c test_gns_lookup.conf
66 gnunet-identity -D "$TEST_TLD" -c test_gns_lookup.conf > /dev/null 2>&1
68 curl_get "$gns_link/www1.$TEST_TLD" "error"
69 gnunet-arm -e -c test_gns_lookup.conf