Add tcp-proxy.sh
parent
293569f715
commit
a0b00096b4
|
@ -0,0 +1,17 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
#if [ "$#" -ne 2 ]; then
|
||||
# echo "usage: $(basename $0) host port"
|
||||
# exit 1
|
||||
#fi
|
||||
|
||||
#HOST="$1"
|
||||
#PORT="$2"
|
||||
|
||||
DOCKER_HOST_IP=$(route -n | awk '/UG[ \t]/{print $2}');
|
||||
|
||||
LISTEN_PORT=${LISTEN_PORT:-${PORT}}
|
||||
HOST=${HOST:-${DOCKER_HOST_IP}}
|
||||
|
||||
echo "relay TCP/IP connections on :${LISTEN_PORT} to ${HOST}:${PORT}"
|
||||
exec socat TCP-LISTEN:${LISTEN_PORT},fork,reuseaddr TCP:${HOST}:${PORT}
|
Loading…
Reference in New Issue