From ff11c335dc6261e782b5b525b2a98dbd940f3d33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=96zg=C3=BCr=20Kesim?= Date: Thu, 27 Aug 2020 18:34:20 +0200 Subject: [PATCH] use conn.RemoteAddr() for remote addr --- tlsserver.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tlsserver.go b/tlsserver.go index c92c660..7bae358 100644 --- a/tlsserver.go +++ b/tlsserver.go @@ -149,14 +149,16 @@ func handleConnection(conn net.Conn, args ...string) { // prepare environment according to tcp-environ(5) lh, lp, err := net.SplitHostPort(conn.LocalAddr().String()) if err != nil { - log.Println(err) + log.Println("net.SplitHostPort(conn.LocalAddr()):", err) return } - rh, rp, err := net.SplitHostPort(conn.LocalAddr().String()) + + rh, rp, err := net.SplitHostPort(conn.RemoteAddr().String()) if err != nil { - log.Println(err) + log.Println("net.SplitHostPort(conn.RemoteAddr()):", err) return } + cmd.Env = make([]string, 0) cmd.Env = append(cmd.Env, "PATH="+os.Getenv("PATH")) cmd.Env = append(cmd.Env, "PROTO=TCP")