add a TLSClientConfig to the QUIC RoundTripper

fixes #407
This commit is contained in:
Marten Seemann
2017-02-04 09:12:35 +07:00
parent e9666c6313
commit 268841f0cc
10 changed files with 28 additions and 14 deletions

View File

@@ -1,6 +1,7 @@
package h2quic
import (
"crypto/tls"
"errors"
"fmt"
"io"
@@ -47,7 +48,7 @@ type Client struct {
var _ h2quicClient = &Client{}
// NewClient creates a new client
func NewClient(t *QuicRoundTripper, hostname string) (*Client, error) {
func NewClient(t *QuicRoundTripper, tlsConfig *tls.Config, hostname string) (*Client, error) {
c := &Client{
t: t,
hostname: authorityAddr("https", hostname),
@@ -57,7 +58,7 @@ func NewClient(t *QuicRoundTripper, hostname string) (*Client, error) {
c.cryptoChangedCond = sync.Cond{L: &c.mutex}
var err error
c.client, err = quic.NewClient(c.hostname, c.cryptoChangeCallback, c.versionNegotiateCallback)
c.client, err = quic.NewClient(c.hostname, tlsConfig, c.cryptoChangeCallback, c.versionNegotiateCallback)
if err != nil {
return nil, err
}