Skip to content

Commit

Permalink
cleanup: measurexlite should not depend on tracex (#1164)
Browse files Browse the repository at this point in the history
I noticed this issue while working on
ooni/probe#2493
  • Loading branch information
bassosimone committed Jun 27, 2023
1 parent 554ad6d commit 1428fb1
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 10 deletions.
3 changes: 1 addition & 2 deletions internal/measurexlite/conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (

"github.com/ooni/probe-cli/v3/internal/model"
"github.com/ooni/probe-cli/v3/internal/netxlite"
"github.com/ooni/probe-cli/v3/internal/tracex"
)

// MaybeClose is a convenience function for closing a conn only when such a conn isn't nil.
Expand Down Expand Up @@ -152,7 +151,7 @@ func NewArchivalNetworkEvent(index int64, started time.Duration, operation strin
tags ...string) *model.ArchivalNetworkEvent {
return &model.ArchivalNetworkEvent{
Address: address,
Failure: tracex.NewFailure(err),
Failure: NewFailure(err),
NumBytes: int64(count),
Operation: operation,
Proto: network,
Expand Down
3 changes: 1 addition & 2 deletions internal/measurexlite/dialer.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import (

"github.com/ooni/probe-cli/v3/internal/model"
"github.com/ooni/probe-cli/v3/internal/netxlite"
"github.com/ooni/probe-cli/v3/internal/tracex"
)

// NewDialerWithoutResolver is equivalent to netxlite.NewDialerWithoutResolver
Expand Down Expand Up @@ -100,7 +99,7 @@ func NewArchivalTCPConnectResult(index int64, started time.Duration, address str
Port: archivalPortToString(port),
Status: model.ArchivalTCPConnectStatus{
Blocked: nil,
Failure: tracex.NewFailure(err),
Failure: NewFailure(err),
Success: err == nil,
},
T0: started.Seconds(),
Expand Down
3 changes: 1 addition & 2 deletions internal/measurexlite/dns.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import (
"github.com/ooni/probe-cli/v3/internal/geoipx"
"github.com/ooni/probe-cli/v3/internal/model"
"github.com/ooni/probe-cli/v3/internal/netxlite"
"github.com/ooni/probe-cli/v3/internal/tracex"
)

// wrapResolver resolver wraps the passed resolver to save data into the trace
Expand Down Expand Up @@ -149,7 +148,7 @@ func NewArchivalDNSLookupResultFromRoundTrip(index int64, started time.Duration,
return &model.ArchivalDNSLookupResult{
Answers: newArchivalDNSAnswers(addrs, response),
Engine: reso.Network(),
Failure: tracex.NewFailure(err),
Failure: NewFailure(err),
GetaddrinfoError: netxlite.ErrorToGetaddrinfoRetvalOrZero(err),
Hostname: query.Domain(),
QueryType: dns.TypeToString[query.Type()],
Expand Down
3 changes: 1 addition & 2 deletions internal/measurexlite/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (
"time"

"github.com/ooni/probe-cli/v3/internal/model"
"github.com/ooni/probe-cli/v3/internal/tracex"
)

// NewArchivalHTTPRequestResult creates a new model.ArchivalHTTPRequestResult.
Expand Down Expand Up @@ -51,7 +50,7 @@ func NewArchivalHTTPRequestResult(index int64, started time.Duration, network, a
Network: network,
Address: address,
ALPN: alpn,
Failure: tracex.NewFailure(err),
Failure: NewFailure(err),
Request: model.ArchivalHTTPRequest{
Body: model.ArchivalMaybeBinaryData{},
BodyIsTruncated: false,
Expand Down
3 changes: 1 addition & 2 deletions internal/measurexlite/tls.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import (

"github.com/ooni/probe-cli/v3/internal/model"
"github.com/ooni/probe-cli/v3/internal/netxlite"
"github.com/ooni/probe-cli/v3/internal/tracex"
)

// NewTLSHandshakerStdlib is equivalent to netxlite.NewTLSHandshakerStdlib
Expand Down Expand Up @@ -87,7 +86,7 @@ func NewArchivalTLSOrQUICHandshakeResult(
Network: network,
Address: address,
CipherSuite: netxlite.TLSCipherSuiteString(state.CipherSuite),
Failure: tracex.NewFailure(err),
Failure: NewFailure(err),
NegotiatedProtocol: state.NegotiatedProtocol,
NoTLSVerify: config.InsecureSkipVerify,
PeerCertificates: TLSPeerCerts(state, err),
Expand Down

0 comments on commit 1428fb1

Please sign in to comment.