add Allow0RTT opt in the quic.Config to control 0-RTT on the server side (#3635)

This commit is contained in:
Marten Seemann
2023-01-04 16:18:11 -08:00
committed by GitHub
parent 421893b1c4
commit b52d34008f
12 changed files with 98 additions and 51 deletions

View File

@@ -241,7 +241,6 @@ var newConnection = func(
conf *Config,
tlsConf *tls.Config,
tokenGenerator *handshake.TokenGenerator,
enable0RTT bool,
clientAddressValidated bool,
tracer logging.ConnectionTracer,
tracingID uint64,
@@ -323,6 +322,10 @@ var newConnection = func(
if s.tracer != nil {
s.tracer.SentTransportParameters(params)
}
var allow0RTT func() bool
if conf.Allow0RTT != nil {
allow0RTT = func() bool { return conf.Allow0RTT(conn.RemoteAddr()) }
}
cs := handshake.NewCryptoSetupServer(
initialStream,
handshakeStream,
@@ -340,7 +343,7 @@ var newConnection = func(
},
},
tlsConf,
enable0RTT,
allow0RTT,
s.rttStats,
tracer,
logger,