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