From 2cb254ef694afb24254165b136f14495e53426b9 Mon Sep 17 00:00:00 2001 From: Russ Magee Date: Mon, 12 Nov 2018 00:44:16 -0800 Subject: [PATCH] Basic -T tun opt parsing Signed-off-by: Russ Magee --- hkexsh/hkexsh.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/hkexsh/hkexsh.go b/hkexsh/hkexsh.go index 4b037f5..96fa048 100755 --- a/hkexsh/hkexsh.go +++ b/hkexsh/hkexsh.go @@ -355,9 +355,15 @@ func parseNonSwitchArgs(a []string) (user, host, path string, isDest bool, other return fancyUser, fancyHost, fancyPath, isDest, otherArgs } -func launchTuns(conn *hkexnet.Conn, remoteHost string, tunSpecs string) { +func launchTuns(conn *hkexnet.Conn, remoteHost string, tuns string) { remAddrs, _ := net.LookupHost(remoteHost) - reqTunnel(conn, 6001, remAddrs[0], 7001) + + tunSpecs := strings.Split(tuns, ",") + for _,tunItem := range tunSpecs { + var lPort, rPort uint16 + _, _ = fmt.Sscanf(tunItem, "%d:%d", &lPort, &rPort) + reqTunnel(conn, lPort, remAddrs[0], rPort) + } } // hkexsh - a client for secure shell and file copy operations.