Skip to content

Commit

Permalink
feat(platform): ssh suport use env proxy (#2131)
Browse files Browse the repository at this point in the history
  • Loading branch information
Leo Ryu committed Oct 27, 2022
1 parent 4022bcf commit 267a158
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pkg/util/ssh/ssh.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import (
"github.com/pkg/sftp"
"github.com/segmentio/ksuid"
"golang.org/x/crypto/ssh"
"golang.org/x/net/proxy"
"gopkg.in/go-playground/validator.v9"
"k8s.io/apimachinery/pkg/util/wait"
"tkestack.io/tke/pkg/util/log"
Expand Down Expand Up @@ -433,7 +434,8 @@ type realSSHDialer struct{}
var _ sshDialer = &realSSHDialer{}

func (d *realSSHDialer) Dial(network, addr string, config *ssh.ClientConfig) (*ssh.Client, error) {
conn, err := net.DialTimeout(network, addr, config.Timeout)
dialer := proxy.FromEnvironmentUsing(&net.Dialer{Timeout: config.Timeout})
conn, err := dialer.Dial(network, addr)
if err != nil {
return nil, err
}
Expand Down

0 comments on commit 267a158

Please sign in to comment.