Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(webconnectivitylte): use NewHTTPTransportWithOptions #1494

Merged
merged 1 commit into from
Feb 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 2 additions & 9 deletions internal/experiment/webconnectivitylte/cleartextflow.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,6 @@ func (t *CleartextFlow) Run(parentCtx context.Context, index int64) error {
trace := measurexlite.NewTrace(index, t.ZeroTime, fmt.Sprintf("depth=%d", t.Depth),
fmt.Sprintf("fetch_body=%v", t.PrioSelector != nil))

// TODO(bassosimone): the DSL starts measuring for throttling when we start
// fetching the body while here we start immediately. We should come up with
// a consistent policy otherwise data won't be comparable.

// start measuring throttling
sampler := throttling.NewSampler(trace)
defer func() {
Expand Down Expand Up @@ -144,10 +140,7 @@ func (t *CleartextFlow) Run(parentCtx context.Context, index int64) error {
}

// create HTTP transport
// TODO(https://github.com/ooni/probe/issues/2534): here we're using the QUIRKY netxlite.NewHTTPTransport
// function, but we can probably avoid using it, given that this code is
// not using tracing and does not care about those quirks.
httpTransport := netxlite.NewHTTPTransport(
httpTransport := netxlite.NewHTTPTransportWithOptions(
t.Logger,
netxlite.NewSingleUseDialer(tcpConn),
netxlite.NewNullTLSDialer(),
Expand Down Expand Up @@ -188,7 +181,7 @@ func (t *CleartextFlow) Run(parentCtx context.Context, index int64) error {
// if enabled, follow possible redirects
t.maybeFollowRedirects(parentCtx, httpResp)

// TODO: insert here additional code if needed
// ignore the response body
_ = httpRespBody

// completed successfully
Expand Down
11 changes: 2 additions & 9 deletions internal/experiment/webconnectivitylte/secureflow.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,6 @@ func (t *SecureFlow) Run(parentCtx context.Context, index int64) error {
trace := measurexlite.NewTrace(index, t.ZeroTime, fmt.Sprintf("depth=%d", t.Depth),
fmt.Sprintf("fetch_body=%v", t.PrioSelector != nil))

// TODO(bassosimone): the DSL starts measuring for throttling when we start
// fetching the body while here we start immediately. We should come up with
// a consistent policy otherwise data won't be comparable.

// start measuring throttling
sampler := throttling.NewSampler(trace)
defer func() {
Expand Down Expand Up @@ -179,10 +175,7 @@ func (t *SecureFlow) Run(parentCtx context.Context, index int64) error {
}

// create HTTP transport
// TODO(https://github.com/ooni/probe/issues/2534): here we're using the QUIRKY netxlite.NewHTTPTransport
// function, but we can probably avoid using it, given that this code is
// not using tracing and does not care about those quirks.
httpTransport := netxlite.NewHTTPTransport(
httpTransport := netxlite.NewHTTPTransportWithOptions(
t.Logger,
netxlite.NewNullDialer(),
netxlite.NewSingleUseTLSDialer(tlsConn),
Expand Down Expand Up @@ -223,7 +216,7 @@ func (t *SecureFlow) Run(parentCtx context.Context, index int64) error {
// if enabled, follow possible redirects
t.maybeFollowRedirects(parentCtx, httpResp)

// TODO: insert here additional code if needed
// ignore the response body
_ = httpRespBody

// completed successfully
Expand Down
4 changes: 4 additions & 0 deletions internal/x/dslvm/quic.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,10 @@ func (sx *QUICHandshakeStage) handshake(ctx context.Context, rtx Runtime, endpoi
return
}

// TODO(https://github.com/ooni/probe/issues/2670).
//
// Start measuring for throttling here.

// handle success
sx.Output <- &QUICConnection{Conn: quicConn, tx: trace, tlsConfig: config}
}
Expand Down
4 changes: 4 additions & 0 deletions internal/x/dslvm/tcp.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,10 @@ func (sx *TCPConnectStage) connect(ctx context.Context, rtx Runtime, endpoint st
return
}

// TODO(https://github.com/ooni/probe/issues/2670).
//
// Start measuring for throttling here.

// handle success
sx.Output <- &TCPConnection{Conn: conn, tx: trace}
}
4 changes: 4 additions & 0 deletions internal/x/dslx/quic.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ func QUICHandshake(rt Runtime, options ...TLSHandshakeOption) Func[*Endpoint, *Q
if quicConn != nil {
closerConn = &quicCloserConn{quicConn}
tlsState = quicConn.ConnectionState().TLS // only quicConn can be nil

// TODO(https://github.com/ooni/probe/issues/2670).
//
// Start measuring for throttling here.
}

// possibly track established conn for late close
Expand Down
4 changes: 4 additions & 0 deletions internal/x/dslx/tcp.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ func TCPConnect(rt Runtime) Func[*Endpoint, *TCPConnection] {
return nil, err
}

// TODO(https://github.com/ooni/probe/issues/2670).
//
// Start measuring for throttling here.

// handle success
state := &TCPConnection{
Address: input.Address,
Expand Down
Loading