From: Amélia Coutard-Sander <git@ameliathe1st.gay>
Date: Mon, 25 Nov 2024 17:22:22 +0000 (+0100)
Subject: Initial Commit
X-Git-Url: https://git.ameliathe1st.gay/?a=commitdiff_plain;h=7b4af0032d074b2dc0157dfa60ca62e27e2b8dc1;p=git-over-gnunet.git

Initial Commit
---

7b4af0032d074b2dc0157dfa60ca62e27e2b8dc1
diff --git a/git-remote-gnunet b/git-remote-gnunet
new file mode 100755
index 0000000..58997c2
--- /dev/null
+++ b/git-remote-gnunet
@@ -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"