@ -232,7 +232,7 @@ func (cc *Client) handleLocalForward(conn net.Conn, remote string) {
}
func (cc *Client) handleRemoteForward(conn net.Conn, local string) {
lconn, err := net.Dial("tcp", local)
lconn, err := dialer.Dial("tcp", local)
if err != nil {
Log(ERROR, "connect to %s failed: %s", local, err.Error())
conn.Close()
@ -5,6 +5,8 @@ import (
"time"
)
var dialer = &net.Dialer{Timeout: 10 * time.Second}
// TimedOutConn is a net.Conn with read/write timeout set
type TimedOutConn struct {
net.Conn
@ -182,7 +182,7 @@ func handleDirectTcpip(newch ssh.NewChannel) {
Log(DEBUG, "create connection to %s:%d", r.Raddr, r.Rport)
rconn, err := net.Dial("tcp", net.JoinHostPort(r.Raddr, fmt.Sprintf("%d", r.Rport)))
rconn, err := dialer.Dial("tcp", net.JoinHostPort(r.Raddr, fmt.Sprintf("%d", r.Rport)))
Log(ERROR, "%s", err.Error())
newch.Reject(ssh.ConnectionFailed, "invalid argument")