(addr string, timeout time.Duration)
| 370 | } |
| 371 | |
| 372 | func (t *TCPTransport) getConnection(addr string, timeout time.Duration) (net.Conn, error) { |
| 373 | var conn net.Conn |
| 374 | var err error |
| 375 | if t.cfg.TLSEnabled { |
| 376 | conn, err = tls.DialWithDialer(&net.Dialer{Timeout: timeout}, "tcp", addr, t.tlsConfig) |
| 377 | } else { |
| 378 | conn, err = net.DialTimeout("tcp", addr, timeout) |
| 379 | } |
| 380 | if err != nil { |
| 381 | return nil, err |
| 382 | } |
| 383 | return newMeteredConn(conn, t.sentBytes, t.receivedBytes), nil |
| 384 | } |
| 385 | |
| 386 | // GetAutoBindPort returns the bind port that was automatically given by the |
| 387 | // kernel, if a bind port of 0 was given. |
no test coverage detected