refactor: merge dnsx and errorsx into netxlite (#517)
When preparing a tutorial for netxlite, I figured it is easier to tell people "hey, this is the package you should use for all low-level networking stuff" rather than introducing people to a set of packages working together where some piece of functionality is here and some other piece is there. Part of https://github.com/ooni/probe/issues/1591
This commit is contained in:
@@ -11,7 +11,7 @@ import (
|
||||
|
||||
"github.com/ooni/probe-cli/v3/internal/engine/experiment/urlgetter"
|
||||
"github.com/ooni/probe-cli/v3/internal/engine/model"
|
||||
"github.com/ooni/probe-cli/v3/internal/netxlite/errorsx"
|
||||
"github.com/ooni/probe-cli/v3/internal/netxlite"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -56,7 +56,7 @@ func (tk *TestKeys) Update(v urlgetter.MultiOutput) {
|
||||
tk.TelegramTCPBlocking = false
|
||||
return // found successful access point connection
|
||||
}
|
||||
if v.TestKeys.FailedOperation == nil || *v.TestKeys.FailedOperation != errorsx.ConnectOperation {
|
||||
if v.TestKeys.FailedOperation == nil || *v.TestKeys.FailedOperation != netxlite.ConnectOperation {
|
||||
tk.TelegramTCPBlocking = false
|
||||
}
|
||||
return
|
||||
|
||||
@@ -12,7 +12,7 @@ import (
|
||||
"github.com/ooni/probe-cli/v3/internal/engine/experiment/urlgetter"
|
||||
"github.com/ooni/probe-cli/v3/internal/engine/mockable"
|
||||
"github.com/ooni/probe-cli/v3/internal/engine/model"
|
||||
"github.com/ooni/probe-cli/v3/internal/netxlite/errorsx"
|
||||
"github.com/ooni/probe-cli/v3/internal/netxlite"
|
||||
)
|
||||
|
||||
func TestNewExperimentMeasurer(t *testing.T) {
|
||||
@@ -94,7 +94,7 @@ func TestUpdateWithNoAccessPointsBlocking(t *testing.T) {
|
||||
},
|
||||
TestKeys: urlgetter.TestKeys{
|
||||
Failure: (func() *string {
|
||||
s := errorsx.FailureEOFError
|
||||
s := netxlite.FailureEOFError
|
||||
return &s
|
||||
})(),
|
||||
},
|
||||
@@ -125,7 +125,7 @@ func TestUpdateWithNilFailedOperation(t *testing.T) {
|
||||
},
|
||||
TestKeys: urlgetter.TestKeys{
|
||||
Failure: (func() *string {
|
||||
s := errorsx.FailureEOFError
|
||||
s := netxlite.FailureEOFError
|
||||
return &s
|
||||
})(),
|
||||
},
|
||||
@@ -137,7 +137,7 @@ func TestUpdateWithNilFailedOperation(t *testing.T) {
|
||||
},
|
||||
TestKeys: urlgetter.TestKeys{
|
||||
Failure: (func() *string {
|
||||
s := errorsx.FailureEOFError
|
||||
s := netxlite.FailureEOFError
|
||||
return &s
|
||||
})(),
|
||||
},
|
||||
@@ -159,11 +159,11 @@ func TestUpdateWithNonConnectFailedOperation(t *testing.T) {
|
||||
},
|
||||
TestKeys: urlgetter.TestKeys{
|
||||
FailedOperation: (func() *string {
|
||||
s := errorsx.ConnectOperation
|
||||
s := netxlite.ConnectOperation
|
||||
return &s
|
||||
})(),
|
||||
Failure: (func() *string {
|
||||
s := errorsx.FailureEOFError
|
||||
s := netxlite.FailureEOFError
|
||||
return &s
|
||||
})(),
|
||||
},
|
||||
@@ -175,11 +175,11 @@ func TestUpdateWithNonConnectFailedOperation(t *testing.T) {
|
||||
},
|
||||
TestKeys: urlgetter.TestKeys{
|
||||
FailedOperation: (func() *string {
|
||||
s := errorsx.HTTPRoundTripOperation
|
||||
s := netxlite.HTTPRoundTripOperation
|
||||
return &s
|
||||
})(),
|
||||
Failure: (func() *string {
|
||||
s := errorsx.FailureEOFError
|
||||
s := netxlite.FailureEOFError
|
||||
return &s
|
||||
})(),
|
||||
},
|
||||
@@ -201,11 +201,11 @@ func TestUpdateWithAllConnectsFailed(t *testing.T) {
|
||||
},
|
||||
TestKeys: urlgetter.TestKeys{
|
||||
FailedOperation: (func() *string {
|
||||
s := errorsx.ConnectOperation
|
||||
s := netxlite.ConnectOperation
|
||||
return &s
|
||||
})(),
|
||||
Failure: (func() *string {
|
||||
s := errorsx.FailureEOFError
|
||||
s := netxlite.FailureEOFError
|
||||
return &s
|
||||
})(),
|
||||
},
|
||||
@@ -217,11 +217,11 @@ func TestUpdateWithAllConnectsFailed(t *testing.T) {
|
||||
},
|
||||
TestKeys: urlgetter.TestKeys{
|
||||
FailedOperation: (func() *string {
|
||||
s := errorsx.ConnectOperation
|
||||
s := netxlite.ConnectOperation
|
||||
return &s
|
||||
})(),
|
||||
Failure: (func() *string {
|
||||
s := errorsx.FailureEOFError
|
||||
s := netxlite.FailureEOFError
|
||||
return &s
|
||||
})(),
|
||||
},
|
||||
@@ -243,11 +243,11 @@ func TestUpdateWebWithMixedResults(t *testing.T) {
|
||||
},
|
||||
TestKeys: urlgetter.TestKeys{
|
||||
FailedOperation: (func() *string {
|
||||
s := errorsx.HTTPRoundTripOperation
|
||||
s := netxlite.HTTPRoundTripOperation
|
||||
return &s
|
||||
})(),
|
||||
Failure: (func() *string {
|
||||
s := errorsx.FailureEOFError
|
||||
s := netxlite.FailureEOFError
|
||||
return &s
|
||||
})(),
|
||||
},
|
||||
@@ -265,7 +265,7 @@ func TestUpdateWebWithMixedResults(t *testing.T) {
|
||||
if tk.TelegramWebStatus != "blocked" {
|
||||
t.Fatal("TelegramWebStatus should be blocked")
|
||||
}
|
||||
if *tk.TelegramWebFailure != errorsx.FailureEOFError {
|
||||
if *tk.TelegramWebFailure != netxlite.FailureEOFError {
|
||||
t.Fatal("invalid TelegramWebFailure")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user