-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
BREAKING CHANGE: feat: move StreamAllContext to netxlite (#1490)
This diff moves the `StreamAllContext` implementation from `webconnectivitylte` to `netxlite`. We flagged this diff as BREAKING CHANGE because we also fixed a bug where, in case of context timeout, `StreamAllContext` was suppressing the error rather than reporting it. Re-reading the code, that felt incorrect because it did not allow us to clearly know that we timed out reading the body, which could be caused by throttling. The new behavior seems more accurate. Because of this change, I also felt it was time to add explicit tests for cases where we download fails because it takes too much time for us to fetch the whole response body. I am not 100% sure we are correctly flagging this case, but an `http-failure` probably seems fine at the moment and we can always revisit this as we learn more about throttling. Part of ooni/probe#2654.
- Loading branch information
1 parent
6ebf265
commit 8b13815
Showing
19 changed files
with
6,094 additions
and
89 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
package webconnectivityqa | ||
|
||
import ( | ||
"time" | ||
|
||
"github.com/apex/log" | ||
"github.com/ooni/netem" | ||
"github.com/ooni/probe-cli/v3/internal/netemx" | ||
) | ||
|
||
// throttlingWithHTTP is the case where an HTTP website has throttling configured for it. | ||
func throttlingWithHTTP() *TestCase { | ||
return &TestCase{ | ||
Name: "throttlingWithHTTP", | ||
Flags: TestCaseFlagNoV04, | ||
Input: "http://largefile.com/", | ||
Configure: func(env *netemx.QAEnv) { | ||
|
||
env.DPIEngine().AddRule(&netem.DPIThrottleTrafficForTCPEndpoint{ | ||
Delay: 300 * time.Millisecond, | ||
Logger: log.Log, | ||
PLR: 0.1, | ||
ServerIPAddress: netemx.AddressLargeFileCom1, | ||
ServerPort: 80, | ||
}) | ||
|
||
env.DPIEngine().AddRule(&netem.DPIThrottleTrafficForTCPEndpoint{ | ||
Delay: 300 * time.Millisecond, | ||
Logger: log.Log, | ||
PLR: 0.1, | ||
ServerIPAddress: netemx.AddressLargeFileCom2, | ||
ServerPort: 80, | ||
}) | ||
|
||
}, | ||
ExpectErr: false, | ||
ExpectTestKeys: &testKeys{ | ||
DNSConsistency: "consistent", | ||
HTTPExperimentFailure: "generic_timeout_error", | ||
XBlockingFlags: 8, // AnalysisBlockingFlagHTTPBlocking | ||
Accessible: false, | ||
Blocking: "http-failure", | ||
}, | ||
} | ||
} | ||
|
||
// throttlingWithHTTPS is the case where an HTTPS website has throttling configured for it. | ||
func throttlingWithHTTPS() *TestCase { | ||
return &TestCase{ | ||
Name: "throttlingWithHTTPS", | ||
Flags: TestCaseFlagNoV04, | ||
Input: "https://largefile.com/", | ||
Configure: func(env *netemx.QAEnv) { | ||
|
||
env.DPIEngine().AddRule(&netem.DPIThrottleTrafficForTLSSNI{ | ||
Delay: 300 * time.Millisecond, | ||
Logger: log.Log, | ||
PLR: 0.1, | ||
SNI: "largefile.com", | ||
}) | ||
|
||
}, | ||
ExpectErr: false, | ||
ExpectTestKeys: &testKeys{ | ||
DNSConsistency: "consistent", | ||
HTTPExperimentFailure: "generic_timeout_error", | ||
XBlockingFlags: 8, // AnalysisBlockingFlagHTTPBlocking | ||
Accessible: false, | ||
Blocking: "http-failure", | ||
}, | ||
} | ||
} |
Oops, something went wrong.