test_dns2gns.sh 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #!/bin/bash
  2. # This file is in the public domain.
  3. trap "gnunet-arm -e -c test_dns2gns.conf" INT
  4. which timeout > /dev/null 2>&1 && DO_TIMEOUT="timeout 30"
  5. LOCATION=$(which gnunet-config)
  6. if [ -z $LOCATION ]
  7. then
  8. LOCATION="gnunet-config"
  9. fi
  10. $LOCATION --version 1> /dev/null
  11. if test $? != 0
  12. then
  13. echo "GNUnet command line tools cannot be found, check environmental variables PATH and GNUNET_PREFIX"
  14. exit 77
  15. fi
  16. rm -rf `gnunet-config -c test_dns2gns.conf -f -s paths -o GNUNET_TEST_HOME`
  17. MY_EGO="localego"
  18. TEST_IP="127.0.0.1"
  19. TEST_IPV6="dead::beef"
  20. LABEL="fnord"
  21. TEST_DOMAIN="gnunet.org"
  22. gnunet-arm -s -c test_dns2gns.conf
  23. PKEY=`gnunet-identity -V -C $MY_EGO -c test_dns2gns.conf`
  24. gnunet-namestore -p -z $MY_EGO -a -n $LABEL -t A -V $TEST_IP -e 3600s -c test_dns2gns.conf
  25. gnunet-namestore -p -z $MY_EGO -a -n $LABEL -t AAAA -V $TEST_IPV6 -e 3600s -c test_dns2gns.conf
  26. # FIXME resolution works but always returns all available records
  27. # also, the records seem to be returned twice if using GNS
  28. if nslookup -port=12000 $LABEL.$PKEY localhost && nslookup -port=12000 $LABEL.$MY_EGO localhost; then
  29. echo "PASS: GNS records can be resolved using dns2gns bridge"
  30. else
  31. echo "FAIL: GNS records can't be resolved using dns2gns bridge"
  32. rm -rf `gnunet-config -c test_dns2gns.conf -f -s paths -o GNUNET_TEST_HOME`
  33. exit 1
  34. fi
  35. if nslookup -port=12000 gnunet.org localhost; then
  36. echo "PASS: DNS records can be resolved using dns2gns bridge"
  37. else
  38. echo "FAIL: DNS records can't be resolved using dns2gns bridge"
  39. rm -rf `gnunet-config -c test_dns2gns.conf -f -s paths -o GNUNET_TEST_HOME`
  40. exit 1
  41. fi
  42. gnunet-arm -e -c test_dns2gns.conf
  43. rm -rf `gnunet-config -c test_dns2gns.conf -f -s paths -o GNUNET_TEST_HOME`