]> git.ameliathe1st.gay Git - git-over-gnunet.git/commitdiff
Initial Commit
authorAmélia Coutard-Sander <git@ameliathe1st.gay>
Mon, 25 Nov 2024 17:22:22 +0000 (18:22 +0100)
committerAmélia Coutard-Sander <git@ameliathe1st.gay>
Mon, 25 Nov 2024 17:22:22 +0000 (18:22 +0100)
git-remote-gnunet [new file with mode: 0755]

diff --git a/git-remote-gnunet b/git-remote-gnunet
new file mode 100755 (executable)
index 0000000..58997c2
--- /dev/null
@@ -0,0 +1,30 @@
+#!/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"