Skip to content

Commit e3be11b

Browse files
authored
upstream: sync to quic-go v0.39.1
sync to upstream quic-go v0.39.1
2 parents 6b99ab6 + 92311cd commit e3be11b

File tree

150 files changed

+3711
-2229
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

150 files changed

+3711
-2229
lines changed

.clusterfuzzlite/Dockerfile

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
FROM gcr.io/oss-fuzz-base/base-builder-go:v1
2+
3+
ARG TARGETPLATFORM
4+
RUN echo "TARGETPLATFORM: ${TARGETPLATFORM}"
5+
6+
ENV GOVERSION=1.20.7
7+
8+
RUN platform=$(echo ${TARGETPLATFORM} | tr '/' '-') && \
9+
filename="go${GOVERSION}.${platform}.tar.gz" && \
10+
wget https://dl.google.com/go/${filename} && \
11+
mkdir temp-go && \
12+
rm -rf /root/.go/* && \
13+
tar -C temp-go/ -xzf ${filename} && \
14+
mv temp-go/go/* /root/.go/ && \
15+
rm -r ${filename} temp-go
16+
17+
RUN apt-get update && apt-get install -y make autoconf automake libtool
18+
19+
COPY . $SRC/quic-go
20+
WORKDIR quic-go
21+
COPY .clusterfuzzlite/build.sh $SRC/

.clusterfuzzlite/build.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/bash -eu
2+
3+
export CXX="${CXX} -lresolv" # required by Go 1.20
4+
5+
compile_go_fuzzer github.com/refraction-networking/uquic/fuzzing/frames Fuzz frame_fuzzer
6+
compile_go_fuzzer github.com/refraction-networking/uquic/fuzzing/header Fuzz header_fuzzer
7+
compile_go_fuzzer github.com/refraction-networking/uquic/fuzzing/transportparameters Fuzz transportparameter_fuzzer
8+
compile_go_fuzzer github.com/refraction-networking/uquic/fuzzing/tokens Fuzz token_fuzzer
9+
compile_go_fuzzer github.com/refraction-networking/uquic/fuzzing/handshake Fuzz handshake_fuzzer

.clusterfuzzlite/project.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
language: go

.github/FUNDING.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# These are supported funding model platforms
2+
3+
github: [marten-seemann] # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
4+
patreon: # Replace with a single Patreon username
5+
open_collective: # Replace with a single Open Collective username
6+
ko_fi: # Replace with a single Ko-fi username
7+
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
8+
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
9+
liberapay: # Replace with a single Liberapay username
10+
issuehunt: # Replace with a single IssueHunt username
11+
otechie: # Replace with a single Otechie username
12+
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
13+
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
[![Ginkgo Test Status](https://github.com/refraction-networking/uquic/actions/workflows/ginkgo_test.yml/badge.svg?branch=master)](https://github.com/refraction-networking/uquic/actions/workflows/ginkgo_test.yml)
55
[![godoc](https://img.shields.io/badge/godoc-reference-blue.svg)](https://godoc.org/github.com/refraction-networking/uquic)
66
---
7-
uQUIC is a fork of [quic-go](https://github.com/quic-go/quic-go), which provides Initial Packet fingerprinting resistance and other features. While the handshake is still performed by quic-go, this library provides interface to customize the unencrypted Initial Packet which may reveal fingerprint-able information.
7+
uQUIC is a fork of [quic-go](https://github.com/refraction-networking/uquic), which provides Initial Packet fingerprinting resistance and other features. While the handshake is still performed by quic-go, this library provides interface to customize the unencrypted Initial Packet which may reveal fingerprint-able information.
88

99
Golang 1.20+ is required.
1010

@@ -32,7 +32,7 @@ If you are interested in our research, please stay tuned for our paper.
3232
- [ ] QUIC ACK Frame (on hold)
3333
- [x] TLS ClientHello Message (by [uTLS](https://github.com/refraction-networking/utls))
3434
- [x] QUIC Transport Parameters (in a uTLS extension)
35-
- [ ] Customize Initial ACK behavior ([#1](https://github.com/refraction-networking/uquic/issues/1), [quic-go#4007](https://github.com/quic-go/quic-go/issues/4007))
35+
- [ ] Customize Initial ACK behavior ([#1](https://github.com/refraction-networking/uquic/issues/1), [quic-go#4007](https://github.com/refraction-networking/uquic/issues/4007))
3636
- [ ] Customize Initial Retry behavior ([#2](https://github.com/refraction-networking/uquic/issues/2))
3737
- [ ] Add preset QUIC parrots
3838
- [x] Google Chrome parrot (call for parrots w/ `Token/PSK`)

client.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ type client struct {
3535

3636
conn quicConn
3737

38-
tracer logging.ConnectionTracer
38+
tracer *logging.ConnectionTracer
3939
tracingID uint64
4040
logger utils.Logger
4141
}
@@ -155,7 +155,7 @@ func dial(
155155
if c.config.Tracer != nil {
156156
c.tracer = c.config.Tracer(context.WithValue(ctx, ConnectionTracingKey, c.tracingID), protocol.PerspectiveClient, c.destConnID)
157157
}
158-
if c.tracer != nil {
158+
if c.tracer != nil && c.tracer.StartedConnection != nil {
159159
c.tracer.StartedConnection(c.sendConn.LocalAddr(), c.sendConn.RemoteAddr(), c.srcConnID, c.destConnID)
160160
}
161161

@@ -238,7 +238,7 @@ func (c *client) dial(ctx context.Context) error {
238238
select {
239239
case <-ctx.Done():
240240
c.conn.shutdown()
241-
return ctx.Err()
241+
return context.Cause(ctx)
242242
case err := <-errorChan:
243243
return err
244244
case recreateErr := <-recreateChan:

client_test.go

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ var _ = Describe("Client", func() {
4444
initialPacketNumber protocol.PacketNumber,
4545
enable0RTT bool,
4646
hasNegotiatedVersion bool,
47-
tracer logging.ConnectionTracer,
47+
tracer *logging.ConnectionTracer,
4848
tracingID uint64,
4949
logger utils.Logger,
5050
v protocol.VersionNumber,
@@ -55,10 +55,11 @@ var _ = Describe("Client", func() {
5555
tlsConf = &tls.Config{NextProtos: []string{"proto1"}}
5656
connID = protocol.ParseConnectionID([]byte{0, 0, 0, 0, 0, 0, 0x13, 0x37})
5757
originalClientConnConstructor = newClientConnection
58-
tracer = mocklogging.NewMockConnectionTracer(mockCtrl)
58+
var tr *logging.ConnectionTracer
59+
tr, tracer = mocklogging.NewMockConnectionTracer(mockCtrl)
5960
config = &Config{
60-
Tracer: func(ctx context.Context, perspective logging.Perspective, id ConnectionID) logging.ConnectionTracer {
61-
return tracer
61+
Tracer: func(ctx context.Context, perspective logging.Perspective, id ConnectionID) *logging.ConnectionTracer {
62+
return tr
6263
},
6364
Versions: []protocol.VersionNumber{protocol.Version1},
6465
}
@@ -71,7 +72,7 @@ var _ = Describe("Client", func() {
7172
destConnID: connID,
7273
version: protocol.Version1,
7374
sendConn: packetConn,
74-
tracer: tracer,
75+
tracer: tr,
7576
logger: utils.DefaultLogger,
7677
}
7778
getMultiplexer() // make the sync.Once execute
@@ -122,7 +123,7 @@ var _ = Describe("Client", func() {
122123
_ protocol.PacketNumber,
123124
enable0RTT bool,
124125
_ bool,
125-
_ logging.ConnectionTracer,
126+
_ *logging.ConnectionTracer,
126127
_ uint64,
127128
_ utils.Logger,
128129
_ protocol.VersionNumber,
@@ -159,7 +160,7 @@ var _ = Describe("Client", func() {
159160
_ protocol.PacketNumber,
160161
enable0RTT bool,
161162
_ bool,
162-
_ logging.ConnectionTracer,
163+
_ *logging.ConnectionTracer,
163164
_ uint64,
164165
_ utils.Logger,
165166
_ protocol.VersionNumber,
@@ -196,7 +197,7 @@ var _ = Describe("Client", func() {
196197
_ protocol.PacketNumber,
197198
_ bool,
198199
_ bool,
199-
_ logging.ConnectionTracer,
200+
_ *logging.ConnectionTracer,
200201
_ uint64,
201202
_ utils.Logger,
202203
_ protocol.VersionNumber,
@@ -281,7 +282,7 @@ var _ = Describe("Client", func() {
281282
_ protocol.PacketNumber,
282283
_ bool,
283284
_ bool,
284-
_ logging.ConnectionTracer,
285+
_ *logging.ConnectionTracer,
285286
_ uint64,
286287
_ utils.Logger,
287288
versionP protocol.VersionNumber,
@@ -324,7 +325,7 @@ var _ = Describe("Client", func() {
324325
pn protocol.PacketNumber,
325326
_ bool,
326327
hasNegotiatedVersion bool,
327-
_ logging.ConnectionTracer,
328+
_ *logging.ConnectionTracer,
328329
_ uint64,
329330
_ utils.Logger,
330331
versionP protocol.VersionNumber,

codecov.yml

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,10 @@
11
coverage:
22
round: nearest
33
ignore:
4-
- streams_map_incoming_bidi.go
5-
- streams_map_incoming_uni.go
6-
- streams_map_outgoing_bidi.go
7-
- streams_map_outgoing_uni.go
84
- http3/gzip_reader.go
95
- interop/
10-
- internal/ackhandler/packet_linkedlist.go
116
- internal/handshake/cipher_suite.go
12-
- internal/utils/byteinterval_linkedlist.go
13-
- internal/utils/newconnectionid_linkedlist.go
14-
- internal/utils/packetinterval_linkedlist.go
157
- internal/utils/linkedlist/linkedlist.go
16-
- logging/null_tracer.go
178
- fuzzing/
189
- metrics/
1910
status:

config.go

Lines changed: 23 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import (
66
"time"
77

88
"github.com/refraction-networking/uquic/internal/protocol"
9-
"github.com/refraction-networking/uquic/internal/utils"
109
"github.com/refraction-networking/uquic/quicvarint"
1110
)
1211

@@ -17,7 +16,11 @@ func (c *Config) Clone() *Config {
1716
}
1817

1918
func (c *Config) handshakeTimeout() time.Duration {
20-
return utils.Max(protocol.DefaultHandshakeTimeout, 2*c.HandshakeIdleTimeout)
19+
return 2 * c.HandshakeIdleTimeout
20+
}
21+
22+
func (c *Config) maxRetryTokenAge() time.Duration {
23+
return c.handshakeTimeout()
2124
}
2225

2326
func validateConfig(config *Config) error {
@@ -50,12 +53,6 @@ func validateConfig(config *Config) error {
5053
// it may be called with nil
5154
func populateServerConfig(config *Config) *Config {
5255
config = populateConfig(config)
53-
if config.MaxTokenAge == 0 {
54-
config.MaxTokenAge = protocol.TokenValidity
55-
}
56-
if config.MaxRetryTokenAge == 0 {
57-
config.MaxRetryTokenAge = protocol.RetryTokenValidity
58-
}
5956
if config.RequireAddressValidation == nil {
6057
config.RequireAddressValidation = func(net.Addr) bool { return false }
6158
}
@@ -110,27 +107,24 @@ func populateConfig(config *Config) *Config {
110107
}
111108

112109
return &Config{
113-
GetConfigForClient: config.GetConfigForClient,
114-
Versions: versions,
115-
HandshakeIdleTimeout: handshakeIdleTimeout,
116-
MaxIdleTimeout: idleTimeout,
117-
MaxTokenAge: config.MaxTokenAge,
118-
MaxRetryTokenAge: config.MaxRetryTokenAge,
119-
RequireAddressValidation: config.RequireAddressValidation,
120-
KeepAlivePeriod: config.KeepAlivePeriod,
121-
InitialStreamReceiveWindow: initialStreamReceiveWindow,
122-
MaxStreamReceiveWindow: maxStreamReceiveWindow,
123-
InitialConnectionReceiveWindow: initialConnectionReceiveWindow,
124-
MaxConnectionReceiveWindow: maxConnectionReceiveWindow,
125-
AllowConnectionWindowIncrease: config.AllowConnectionWindowIncrease,
126-
MaxIncomingStreams: maxIncomingStreams,
127-
MaxIncomingUniStreams: maxIncomingUniStreams,
128-
TokenStore: config.TokenStore,
129-
EnableDatagrams: config.EnableDatagrams,
130-
DisablePathMTUDiscovery: config.DisablePathMTUDiscovery,
131-
DisableVersionNegotiationPackets: config.DisableVersionNegotiationPackets,
132-
Allow0RTT: config.Allow0RTT,
133-
Tracer: config.Tracer,
110+
GetConfigForClient: config.GetConfigForClient,
111+
Versions: versions,
112+
HandshakeIdleTimeout: handshakeIdleTimeout,
113+
MaxIdleTimeout: idleTimeout,
114+
RequireAddressValidation: config.RequireAddressValidation,
115+
KeepAlivePeriod: config.KeepAlivePeriod,
116+
InitialStreamReceiveWindow: initialStreamReceiveWindow,
117+
MaxStreamReceiveWindow: maxStreamReceiveWindow,
118+
InitialConnectionReceiveWindow: initialConnectionReceiveWindow,
119+
MaxConnectionReceiveWindow: maxConnectionReceiveWindow,
120+
AllowConnectionWindowIncrease: config.AllowConnectionWindowIncrease,
121+
MaxIncomingStreams: maxIncomingStreams,
122+
MaxIncomingUniStreams: maxIncomingUniStreams,
123+
TokenStore: config.TokenStore,
124+
EnableDatagrams: config.EnableDatagrams,
125+
DisablePathMTUDiscovery: config.DisablePathMTUDiscovery,
126+
Allow0RTT: config.Allow0RTT,
127+
Tracer: config.Tracer,
134128
}
135129
}
136130

config_test.go

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,6 @@ var _ = Describe("Config", func() {
7878
f.Set(reflect.ValueOf(time.Second))
7979
case "MaxIdleTimeout":
8080
f.Set(reflect.ValueOf(time.Hour))
81-
case "MaxTokenAge":
82-
f.Set(reflect.ValueOf(2 * time.Hour))
83-
case "MaxRetryTokenAge":
84-
f.Set(reflect.ValueOf(2 * time.Minute))
8581
case "TokenStore":
8682
f.Set(reflect.ValueOf(NewLRUTokenStore(2, 3)))
8783
case "InitialStreamReceiveWindow":
@@ -115,12 +111,7 @@ var _ = Describe("Config", func() {
115111
return c
116112
}
117113

118-
It("uses 10s handshake timeout for short handshake idle timeouts", func() {
119-
c := &Config{HandshakeIdleTimeout: time.Second}
120-
Expect(c.handshakeTimeout()).To(Equal(protocol.DefaultHandshakeTimeout))
121-
})
122-
123-
It("uses twice the handshake idle timeouts for the handshake timeout, for long handshake idle timeouts", func() {
114+
It("uses twice the handshake idle timeouts for the handshake timeout", func() {
124115
c := &Config{HandshakeIdleTimeout: time.Second * 11 / 2}
125116
Expect(c.handshakeTimeout()).To(Equal(11 * time.Second))
126117
})
@@ -132,7 +123,7 @@ var _ = Describe("Config", func() {
132123
GetConfigForClient: func(info *ClientHelloInfo) (*Config, error) { return nil, errors.New("nope") },
133124
AllowConnectionWindowIncrease: func(Connection, uint64) bool { calledAllowConnectionWindowIncrease = true; return true },
134125
RequireAddressValidation: func(net.Addr) bool { calledAddrValidation = true; return true },
135-
Tracer: func(context.Context, logging.Perspective, ConnectionID) logging.ConnectionTracer {
126+
Tracer: func(context.Context, logging.Perspective, ConnectionID) *logging.ConnectionTracer {
136127
calledTracer = true
137128
return nil
138129
},
@@ -192,7 +183,6 @@ var _ = Describe("Config", func() {
192183
Expect(c.MaxConnectionReceiveWindow).To(BeEquivalentTo(protocol.DefaultMaxReceiveConnectionFlowControlWindow))
193184
Expect(c.MaxIncomingStreams).To(BeEquivalentTo(protocol.DefaultMaxIncomingStreams))
194185
Expect(c.MaxIncomingUniStreams).To(BeEquivalentTo(protocol.DefaultMaxIncomingUniStreams))
195-
Expect(c.DisableVersionNegotiationPackets).To(BeFalse())
196186
Expect(c.DisablePathMTUDiscovery).To(BeFalse())
197187
Expect(c.GetConfigForClient).To(BeNil())
198188
})

0 commit comments

Comments
 (0)