DialContext connects to the given network address and initiates a TLS handshake, returning the resulting TLS connection. The provided Context must be non-nil. If the context expires before the connection is complete, an error is returned. Once successfully connected, any expiration of the context w
(ctx context.Context, network, addr string)
| 688 | // |
| 689 | // The returned [Conn], if any, will always be of type *[Conn]. |
| 690 | func (d *Dialer) DialContext(ctx context.Context, network, addr string) (net.Conn, error) { |
| 691 | c, err := dial(ctx, d.netDialer(), network, addr, d.Config) |
| 692 | if err != nil { |
| 693 | // Don't return c (a typed nil) in an interface. |
| 694 | return nil, err |
| 695 | } |
| 696 | return c, nil |
| 697 | } |
| 698 | |
| 699 | // LoadX509KeyPair reads and parses a public/private key pair from a pair of |
| 700 | // files. The files must contain PEM encoded data. The certificate file may |