From 7b4af0032d074b2dc0157dfa60ca62e27e2b8dc1 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Am=C3=A9lia=20Coutard-Sander?= Date: Mon, 25 Nov 2024 18:22:22 +0100 Subject: [PATCH] Initial Commit --- git-remote-gnunet | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100755 git-remote-gnunet 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" -- 2.46.0