Ran
|
Files
9
|
Run time
0s
|
Badge
Embed ▾
README BADGES
|
push
travis-ci
mlabns: make implementation more flexible (#13) * mlabns: make implementation more flexible To this end, expose implementation details that allow to override the way in which a request is created and serviced. This is mainly driven by the following OONI needs. When a OONI client is behind a proxy (e.g. Tor's SOCKS5 proxy), it needs to adjust its behaviour to still be able to perform ndt7 tests correctly. To this end, it needs: 1. to contact mlabns using the proxy. In OONI we honour the HTTP_PROXY environment variable but we also have more specific proxy settings that are configured through a specialized http.Client. To allow for OONI to do the latter, this PR exposes the HTTPRequestor publicly, so that we can override the default with our specialized client. (I can hear an argument that it's possible to do all of this by just using the proxy environment variable; yet, we use the specialized client also for other functionality, including (1) measuring and logging everything that happens, because we're concerned about censorship and we want therefore to log what happens at low level; (2) possibly overwriting DNS resolution to use DoH or alternative name servers. As such we actually need to have HTTPRequestory public and I don't see how we can get away with just the HTTP_PROXY environment variable). 2. to modify the mlabns http.Request before it's issued so that it can append the proper query string arguments. To this end, it needs to replace the default HTTPRequestMaker with one that calls the original and then changes the query. My initial solution to solve the above problems have been vendoring mlabns, but that's sub-optimal and I'd rather have a more flexible implementation here. I can also see how others may want to have this similar kind of flexibility for their packages and/or tests. See also https://github.com/ooni/probe-engine/commit/dfc0e04dc * Avoid publicly exposing ... (continued)
401 of 401 relevant lines covered (100.0%)
1.09 hits per line
Coverage | ∆ | File | Lines | Relevant | Covered | Missed | Hits/Line |
---|