aboutsummaryrefslogtreecommitdiff
path: root/third_party/websockify/rebind
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2012-09-30 10:24:53 -0700
committerAlon Zakai <alonzakai@gmail.com>2012-09-30 10:24:53 -0700
commitb614f2bc5d9fc421565824b1ceb9a3384f26f35f (patch)
tree243c47baa4c6ce4273a5743d79f3c0dbc78789e5 /third_party/websockify/rebind
parentc70758e3b49beb016a3d9db7b609c499d55de48b (diff)
parent7eaa78060c34489c7e56193c725641303d520f31 (diff)
Merge branch 'incoming'
Diffstat (limited to 'third_party/websockify/rebind')
-rwxr-xr-xthird_party/websockify/rebind18
1 files changed, 18 insertions, 0 deletions
diff --git a/third_party/websockify/rebind b/third_party/websockify/rebind
new file mode 100755
index 00000000..2289aaa4
--- /dev/null
+++ b/third_party/websockify/rebind
@@ -0,0 +1,18 @@
+#!/usr/bin/env bash
+
+usage() {
+ echo "Usage: $(basename $0) OLD_PORT NEW_PORT COMMAND_LINE"
+ echo
+ echo "Launch COMMAND_LINE, but intercept system calls to bind"
+ echo "to OLD_PORT and instead bind them to localhost:NEW_PORT"
+ exit 2
+}
+
+# Parameter defaults
+mydir=$(readlink -f $(dirname ${0}))
+
+export REBIND_PORT_OLD="${1}"; shift
+export REBIND_PORT_NEW="${1}"; shift
+
+LD_PRELOAD=${mydir}/rebind.so "${@}"
+