From 6f1fcbbf7a41743d128bb19fc18185ab31f310a3 Mon Sep 17 00:00:00 2001 From: Russ Magee Date: Sun, 11 Nov 2018 20:25:34 -0800 Subject: [PATCH] Corrected tun chan Ctl cmd comments --- hkexnet/consts.go | 34 ++++++++-------------------------- hkexnet/hkextun.go | 2 -- hkexsh/hkexsh.go | 1 - 3 files changed, 8 insertions(+), 29 deletions(-) diff --git a/hkexnet/consts.go b/hkexnet/consts.go index 6188515..7f6e3bf 100644 --- a/hkexnet/consts.go +++ b/hkexnet/consts.go @@ -58,42 +58,24 @@ const ( CSOTunSetup // client -> server tunnel setup request (dstport) CSOTunSetupAck // server -> client tunnel setup ack CSOTunAccept // client -> server: tunnel client got an Accept() - // (Do we need a CSOTunAcceptAck server->client?) - CSOTunRefused // server -> client: tunnel rport connection refused - CSOTunData // packet contains tunnel data [rport:data] - CSOTunDisconn // server -> client: tunnel rport disconnected - CSOTunHangup // client -> server: tunnel lport hung up + CSOTunRefused // server -> client: tunnel rport connection refused + CSOTunData // packet contains tunnel data [rport:data] + CSOTunDisconn // server -> client: tunnel rport disconnected + CSOTunHangup // client -> server: tunnel lport hung up ) // TunEndpoint.tunCtl control values - used to control workers for client or server tunnels // depending on the code const ( TunCtl_Client_Listen = 'a' + // [CSOTunAccept] + // status: server has ack'd tun setup request + // action: client should accept (after re-listening, if required) on lport TunCtl_Server_Dial = 'd' // server has dialled OK, client side can accept() conns // [CSOTunAccept] - // status: client listen() worker accepted conn on lport + // status: client wants to open tunnel to rport // action:server side should dial() rport on client's behalf - - // -rlm 20181111 - useless as serverTun worker might in within a Read() or Write(), - // so timeouts must be used and tun.Died flag - // -- - //TunCtl_Info_Hangup = 'h' // client side has hung up - // [CSOTunHangup] - // status: client side conn hung up from lport - // action:server side should hang up on rport, on client's behalf - - TunCtl_Info_ConnRefused = 'r' // server side couldn't complete tunnel - // [CSOTunRefused] - // status:server side could not dial() remote side - - // -rlm 20181111 - useless as clientTun worker might in within a Read() or Write(), - // so timeouts must be used and tun.Died flag - // -- - //TunCtl_Info_LostConn = 'x' // server side disconnected - // [CSOTunDisconn] - // status:server side lost connection to rport - // action:client should disconnect accepted lport connection ) // Channel status Op byte type diff --git a/hkexnet/hkextun.go b/hkexnet/hkextun.go index 915bb12..4f85d65 100644 --- a/hkexnet/hkextun.go +++ b/hkexnet/hkextun.go @@ -230,8 +230,6 @@ func (hc *Conn) StartClientTunnel(lport, rport uint16) { delete((*hc.tuns), rport) } // end for-accept } // end Listen() block - } else if cmd == 'r' { - logger.LogDebug(fmt.Sprintf("[ClientTun] Server replied TunRefused %v\n", (*hc.tuns)[rport])) } } // end t.Ctl for }() diff --git a/hkexsh/hkexsh.go b/hkexsh/hkexsh.go index d6bc24e..0e7718a 100755 --- a/hkexsh/hkexsh.go +++ b/hkexsh/hkexsh.go @@ -346,7 +346,6 @@ func reqTunnel(hc *hkexnet.Conn, lp uint16, p string /*net.Addr*/, rp uint16) { var bTmp bytes.Buffer binary.Write(&bTmp, binary.BigEndian, lp) binary.Write(&bTmp, binary.BigEndian, rp) - fmt.Printf("bTmp:%x\n", bTmp.Bytes()) logger.LogDebug(fmt.Sprintln("[Client sending CSOTunSetup]")) hc.WritePacket(bTmp.Bytes(), hkexnet.CSOTunSetup)