Skip to content

Commit 3652dde

Browse files
committed
Transparent of SSH configurations and clients
1 parent 696506d commit 3652dde

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

client.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ func NewDialer(addr string) (*Dialer, error) {
2121
if err != nil {
2222
return nil, err
2323
}
24+
return NewDialerWithConfig(host, config)
25+
}
26+
27+
func NewDialerWithConfig(host string, config *ssh.ClientConfig) (*Dialer, error) {
2428
return &Dialer{
2529
host: host,
2630
config: config,
@@ -93,6 +97,12 @@ type Dialer struct {
9397
config *ssh.ClientConfig
9498
}
9599

100+
func (d *Dialer) SSHClient() *ssh.Client {
101+
d.mut.Lock()
102+
defer d.mut.Unlock()
103+
return d.sshCli
104+
}
105+
96106
func (d *Dialer) reset() error {
97107
d.mut.Lock()
98108
defer d.mut.Unlock()

0 commit comments

Comments
 (0)