custom switches to tunnels
This commit is contained in:
@@ -36,8 +36,8 @@ done
|
|||||||
|
|
||||||
[[ -f "$CONF" ]] || {
|
[[ -f "$CONF" ]] || {
|
||||||
echo No config file.
|
echo No config file.
|
||||||
echo "$CONF" each line like:
|
echo "$CONF each line like (comma separated list of localport:host:remoteport, or ssh switches):"
|
||||||
echo "servername: 8888,8889:8989,8890:host:9090"
|
echo "servername: 8888,8889:8989,8890:host:9090,-4"
|
||||||
mkdir -p "$CONFDIR"
|
mkdir -p "$CONFDIR"
|
||||||
echo -e "# example:\nservername: 8888,8889:8989,8890:host:9090" > "$CONF"
|
echo -e "# example:\nservername: 8888,8889:8989,8890:host:9090" > "$CONF"
|
||||||
}
|
}
|
||||||
@@ -71,8 +71,13 @@ function parse_switches() {
|
|||||||
import sys
|
import sys
|
||||||
host, tunnels = sys.stdin.read(1024*10).split(':',1)
|
host, tunnels = sys.stdin.read(1024*10).split(':',1)
|
||||||
|
|
||||||
for i, tunnel in enumerate(tunnels.split(',')):
|
for i, cmd in enumerate(tunnels.split(',')):
|
||||||
tunnel = tunnel.strip().split(':')
|
cmd = cmd.strip()
|
||||||
|
if cmd.startswith('-'):
|
||||||
|
sys.stdout.write('{} '.format(cmd))
|
||||||
|
sys.stderr.write('Added switch {}\n'.format(cmd))
|
||||||
|
continue
|
||||||
|
tunnel = cmd.split(':')
|
||||||
thost='localhost'
|
thost='localhost'
|
||||||
if len(tunnel) == 1:
|
if len(tunnel) == 1:
|
||||||
tport=tunnel[0]
|
tport=tunnel[0]
|
||||||
|
|||||||
Reference in New Issue
Block a user