Skip to content

Commit

Permalink
feat: update client for TLS (#51)
Browse files Browse the repository at this point in the history
  • Loading branch information
verbotenj authored Oct 23, 2024
1 parent 5e71ffb commit 6d1abf5
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,18 @@ func createHttpClient() *http.Client {
},
Transport: &http2.Transport{
AllowHTTP: true,
DialTLS: func(network, addr string, _ *tls.Config) (net.Conn, error) {
DialTLS: func(network, addr string, tlsConfig *tls.Config) (net.Conn, error) {
// If you're also using this client for non-h2c traffic, you may want
// to delegate to tls.Dial if the network isn't TCP or the addr isn't
// in an allowlist.
return net.Dial(network, addr)
// return net.Dial(network, addr)

// Establish a TLS connection using the custom TLS configuration
conn, err := tls.Dial(network, addr, tlsConfig)
if err != nil {
return nil, fmt.Errorf("failed to establish TLS connection: %w", err)
}
return conn, nil
},
},
}
Expand Down

0 comments on commit 6d1abf5

Please sign in to comment.