remove the tls.Config from the quic.Config

The tls.Config now is a separate parameter to all Listen and Dial
functions in the quic package.
This commit is contained in:
Marten Seemann
2017-06-30 17:33:35 +02:00
parent 890b801a60
commit a851aaacda
14 changed files with 126 additions and 86 deletions

View File

@@ -45,7 +45,7 @@ var _ = Describe("Client", func() {
It("saves the TLS config", func() {
tlsConf := &tls.Config{InsecureSkipVerify: true}
client = newClient(tlsConf, "", &roundTripperOpts{})
Expect(client.config.TLSConfig).To(Equal(tlsConf))
Expect(client.tlsConf).To(Equal(tlsConf))
})
It("adds the port to the hostname, if none is given", func() {
@@ -56,7 +56,7 @@ var _ = Describe("Client", func() {
It("dials", func(done Done) {
client = newClient(nil, "localhost:1337", &roundTripperOpts{})
session.streamsToOpen = []quic.Stream{newMockStream(3), newMockStream(5)}
client.dialAddr = func(hostname string, conf *quic.Config) (quic.Session, error) {
client.dialAddr = func(hostname string, _ *tls.Config, _ *quic.Config) (quic.Session, error) {
return session, nil
}
close(headerStream.unblockRead)
@@ -68,7 +68,7 @@ var _ = Describe("Client", func() {
It("errors when dialing fails", func() {
testErr := errors.New("handshake error")
client = newClient(nil, "localhost:1337", &roundTripperOpts{})
client.dialAddr = func(hostname string, conf *quic.Config) (quic.Session, error) {
client.dialAddr = func(hostname string, _ *tls.Config, _ *quic.Config) (quic.Session, error) {
return nil, testErr
}
_, err := client.RoundTrip(req)
@@ -78,7 +78,7 @@ var _ = Describe("Client", func() {
It("errors if the header stream has the wrong stream ID", func() {
client = newClient(nil, "localhost:1337", &roundTripperOpts{})
session.streamsToOpen = []quic.Stream{&mockStream{id: 2}}
client.dialAddr = func(hostname string, conf *quic.Config) (quic.Session, error) {
client.dialAddr = func(hostname string, _ *tls.Config, _ *quic.Config) (quic.Session, error) {
return session, nil
}
_, err := client.RoundTrip(req)
@@ -89,7 +89,7 @@ var _ = Describe("Client", func() {
testErr := errors.New("you shall not pass")
client = newClient(nil, "localhost:1337", &roundTripperOpts{})
session.streamOpenErr = testErr
client.dialAddr = func(hostname string, conf *quic.Config) (quic.Session, error) {
client.dialAddr = func(hostname string, _ *tls.Config, _ *quic.Config) (quic.Session, error) {
return session, nil
}
_, err := client.RoundTrip(req)
@@ -98,7 +98,7 @@ var _ = Describe("Client", func() {
It("returns a request when dial fails", func() {
testErr := errors.New("dial error")
client.dialAddr = func(hostname string, conf *quic.Config) (quic.Session, error) {
client.dialAddr = func(hostname string, _ *tls.Config, _ *quic.Config) (quic.Session, error) {
return nil, testErr
}
request, err := http.NewRequest("https", "https://quic.clemente.io:1337/file1.dat", nil)
@@ -140,7 +140,7 @@ var _ = Describe("Client", func() {
BeforeEach(func() {
var err error
client.encryptionLevel = protocol.EncryptionForwardSecure
client.dialAddr = func(hostname string, conf *quic.Config) (quic.Session, error) {
client.dialAddr = func(hostname string, _ *tls.Config, _ *quic.Config) (quic.Session, error) {
return session, nil
}
dataStream = newMockStream(5)