~juju-qa/ubuntu/xenial/juju/2.0-rc2

« back to all changes in this revision

Viewing changes to src/golang.org/x/crypto/ssh/client.go

  • Committer: Nicholas Skaggs
  • Date: 2016-09-30 14:39:30 UTC
  • mfrom: (1.8.1)
  • Revision ID: nicholas.skaggs@canonical.com-20160930143930-vwwhrefh6ftckccy
import upstream

Show diffs side-by-side

added added

removed removed

Lines of Context:
9
9
        "fmt"
10
10
        "net"
11
11
        "sync"
 
12
        "time"
12
13
)
13
14
 
14
15
// Client implements a traditional SSH client that supports shells,
96
97
        c.transport = newClientTransport(
97
98
                newTransport(c.sshConn.conn, config.Rand, true /* is client */),
98
99
                c.clientVersion, c.serverVersion, config, dialAddress, c.sshConn.RemoteAddr())
99
 
        if err := c.transport.requestKeyChange(); err != nil {
100
 
                return err
101
 
        }
102
 
 
103
 
        if packet, err := c.transport.readPacket(); err != nil {
104
 
                return err
105
 
        } else if packet[0] != msgNewKeys {
106
 
                return unexpectedMessageError(msgNewKeys, packet[0])
 
100
        if err := c.transport.requestInitialKeyChange(); err != nil {
 
101
                return err
107
102
        }
108
103
 
109
104
        // We just did the key change, so the session ID is established.
169
164
// to incoming channels and requests, use net.Dial with NewClientConn
170
165
// instead.
171
166
func Dial(network, addr string, config *ClientConfig) (*Client, error) {
172
 
        conn, err := net.Dial(network, addr)
 
167
        conn, err := net.DialTimeout(network, addr, config.Timeout)
173
168
        if err != nil {
174
169
                return nil, err
175
170
        }
210
205
        // string returned from PublicKey.Type method may be used, or
211
206
        // any of the CertAlgoXxxx and KeyAlgoXxxx constants.
212
207
        HostKeyAlgorithms []string
 
208
 
 
209
        // Timeout is the maximum amount of time for the TCP connection to establish.
 
210
        //
 
211
        // A Timeout of zero means no timeout.
 
212
        Timeout time.Duration
213
213
}