--- /dev/null
+#!/usr/bin/env bash
+
+if [[ "$2" = gnunet://* ]]; then
+ gns=${2:9}
+else
+ gns=$2
+fi
+
+while read -r cmd arg; do
+ case "$cmd" in
+ capabilities)
+ echo 'connect'
+ echo ''
+ ;;
+ connect)
+ break
+ ;;
+ esac
+done
+
+echo ''
+server="$(gnunet-gns -u "$gns" -t TXT -r)"
+if test -z "$server"; then
+ echo "Address lookup failed: \`$gns'." >&2
+ exit 1
+fi
+peer="$(echo "$server" | cut -d: -f1)"
+port="$(echo "$server" | cut -d: -f2)"
+echo "Attempting to connect to peer $peer, on port $port-$arg." >&2
+gnunet-cadet "$peer" "$port-$arg"