refactor(simplequicping): use step-by-step (#852)
See https://github.com/ooni/probe/issues/2159 and https://github.com/ooni/spec/pull/254
This commit is contained in:
@@ -134,8 +134,14 @@ func (d *quicDialerQUICGo) DialContext(ctx context.Context, network string,
|
||||
return nil, err
|
||||
}
|
||||
tlsConfig = d.maybeApplyTLSDefaults(tlsConfig, udpAddr.Port)
|
||||
trace := ContextTraceOrDefault(ctx)
|
||||
started := trace.TimeNow()
|
||||
trace.OnQUICHandshakeStart(started, address, quicConfig)
|
||||
qconn, err := d.dialEarlyContext(
|
||||
ctx, pconn, udpAddr, address, tlsConfig, quicConfig)
|
||||
finished := trace.TimeNow()
|
||||
err = MaybeNewErrWrapper(ClassifyQUICHandshakeError, QUICHandshakeOperation, err)
|
||||
trace.OnQUICHandshakeDone(started, address, qconn, tlsConfig, err, finished)
|
||||
if err != nil {
|
||||
pconn.Close() // we own it on failure
|
||||
return nil, err
|
||||
|
||||
@@ -9,6 +9,7 @@ import (
|
||||
"crypto/tls"
|
||||
"time"
|
||||
|
||||
"github.com/lucas-clemente/quic-go"
|
||||
"github.com/ooni/probe-cli/v3/internal/model"
|
||||
"github.com/ooni/probe-cli/v3/internal/runtimex"
|
||||
)
|
||||
@@ -71,3 +72,12 @@ func (*traceDefault) OnTLSHandshakeDone(started time.Time, remoteAddr string, co
|
||||
state tls.ConnectionState, err error, finished time.Time) {
|
||||
// nothing
|
||||
}
|
||||
|
||||
func (*traceDefault) OnQUICHandshakeStart(now time.Time, remoteAddr string, config *quic.Config) {
|
||||
// nothing
|
||||
}
|
||||
|
||||
func (*traceDefault) OnQUICHandshakeDone(started time.Time, remoteAddr string, qconn quic.EarlyConnection,
|
||||
config *tls.Config, err error, finished time.Time) {
|
||||
// nothing
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user