add the TokenStore to the quic.Config, store received tokens

This commit is contained in:
Marten Seemann
2019-08-08 12:29:35 +07:00
parent fe0f7aff3b
commit 9c97a5e95f
7 changed files with 123 additions and 4 deletions

View File

@@ -444,6 +444,7 @@ var _ = Describe("Client", func() {
Context("quic.Config", func() {
It("setups with the right values", func() {
tracer := quictrace.NewTracer()
tokenStore := NewLRUTokenStore(10, 4)
config := &Config{
HandshakeTimeout: 1337 * time.Minute,
IdleTimeout: 42 * time.Hour,
@@ -452,6 +453,7 @@ var _ = Describe("Client", func() {
ConnectionIDLength: 13,
StatelessResetKey: []byte("foobar"),
QuicTracer: tracer,
TokenStore: tokenStore,
}
c := populateClientConfig(config, false)
Expect(c.HandshakeTimeout).To(Equal(1337 * time.Minute))
@@ -461,6 +463,7 @@ var _ = Describe("Client", func() {
Expect(c.ConnectionIDLength).To(Equal(13))
Expect(c.StatelessResetKey).To(Equal([]byte("foobar")))
Expect(c.QuicTracer).To(Equal(tracer))
Expect(c.TokenStore).To(Equal(tokenStore))
})
It("errors when the Config contains an invalid version", func() {