use conn.RemoteAddr() for remote addr

This commit is contained in:
Özgür Kesim 2020-08-27 18:34:20 +02:00
parent 2d6bdd9fb5
commit ff11c335dc

View File

@ -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")