aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakob Odersky <jakob@odersky.com>2019-12-25 22:24:48 +0100
committerJakob Odersky <jakob@odersky.com>2019-12-25 22:24:48 +0100
commitd948938641c4a18e9df40414f2a5e72dc01353ee (patch)
tree175471db965fba31eb77f216eadfefdaee757d76
parenta57c12ac80bb022a5416bd4b7822900ebb32443f (diff)
downloaddotfiles-d948938641c4a18e9df40414f2a5e72dc01353ee.tar.gz
dotfiles-d948938641c4a18e9df40414f2a5e72dc01353ee.tar.bz2
dotfiles-d948938641c4a18e9df40414f2a5e72dc01353ee.zip
Add mgrok, poor man's alternative to ngrok
-rwxr-xr-xhome/bin/mgrok18
1 files changed, 18 insertions, 0 deletions
diff --git a/home/bin/mgrok b/home/bin/mgrok
new file mode 100755
index 0000000..1cce083
--- /dev/null
+++ b/home/bin/mgrok
@@ -0,0 +1,18 @@
+#!/bin/bash
+# Simple ngrok alternative, using an SSH reverse tunnel on
+# an internet-accessible server.
+set -o errexit
+
+port="$1"
+if [[ -z "$port" ]]; then
+ echo "must specify port" >&2
+ echo "Usage: mgrok PORT" >&2
+ exit 1
+fi
+
+echo "Exposing localhost:$port at https://dev.crashbox.io"
+echo "Press Ctrl+C to stop" >&2
+
+# The remote server is assumed to proxy http(s) traffic
+# destined to dev.crashbox.io to localhost:8080
+exec ssh -N -T -R8080:localhost:"$1" dev.crashbox.io