From a71905d698a1cf2e7e1aef06a9f29704e9d94b64 Mon Sep 17 00:00:00 2001 From: akilan Date: Sat, 9 Jan 2021 19:42:53 +0400 Subject: [PATCH] added unchanged stuff --- .gitignore | 0 Makefile | 0 README | 0 client/client.go | 0 client/list-servers.go | 0 dissertation-1.pdf | Bin docs/Installation.txt | 0 go.mod | 0 go.sum | 0 server/container.go | 0 server/ipfs-ssh.sh | 31 +++++++++++++++++++++++++++++++ server/server.go | 0 12 files changed, 31 insertions(+) mode change 100644 => 100755 .gitignore mode change 100644 => 100755 Makefile mode change 100644 => 100755 README mode change 100644 => 100755 client/client.go mode change 100644 => 100755 client/list-servers.go mode change 100644 => 100755 dissertation-1.pdf mode change 100644 => 100755 docs/Installation.txt mode change 100644 => 100755 go.mod mode change 100644 => 100755 go.sum mode change 100644 => 100755 server/container.go create mode 100644 server/ipfs-ssh.sh mode change 100644 => 100755 server/server.go diff --git a/.gitignore b/.gitignore old mode 100644 new mode 100755 diff --git a/Makefile b/Makefile old mode 100644 new mode 100755 diff --git a/README b/README old mode 100644 new mode 100755 diff --git a/client/client.go b/client/client.go old mode 100644 new mode 100755 diff --git a/client/list-servers.go b/client/list-servers.go old mode 100644 new mode 100755 diff --git a/dissertation-1.pdf b/dissertation-1.pdf old mode 100644 new mode 100755 diff --git a/docs/Installation.txt b/docs/Installation.txt old mode 100644 new mode 100755 diff --git a/go.mod b/go.mod old mode 100644 new mode 100755 diff --git a/go.sum b/go.sum old mode 100644 new mode 100755 diff --git a/server/container.go b/server/container.go old mode 100644 new mode 100755 diff --git a/server/ipfs-ssh.sh b/server/ipfs-ssh.sh new file mode 100644 index 0000000..74fce0c --- /dev/null +++ b/server/ipfs-ssh.sh @@ -0,0 +1,31 @@ +#!/usr/bin/env bash + +#Implementation from (https://gist.github.com/Kubuxu/0cafd6dc71114349875827c2c379fa1f) +REMOTE_HOST=${1-"YOUR REMOTE HOST HERE"} +DEFAULT_API_FILE="$HOME/.ipfs/api" +API_FILE="${IPFS_PATH-$DEFAULT_API_FILE}" + +if [ -e "$API_FILE" ]; then + echo "IPFS API is already running" + exit 1 +fi + +PORT=5001 +ssh -N -L ${PORT}:localhost:5001 $REMOTE_HOST & +SSH_PID=$! + +function cleanupAndExit() { + rm -f "$API_FILE" + echo + echo "Killing ssh." + kill "$SSH_PID" + exit +} +trap cleanupAndExit INT + +printf "/ip4/127.0.0.1/tcp/$PORT" > "$API_FILE" + +echo "Linked local API to $REMOTE_HOST." + +wait $SSH_PID +rm -f "$API_FILE" \ No newline at end of file diff --git a/server/server.go b/server/server.go old mode 100644 new mode 100755