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

feat(netxlite): add HTTP/HTTPS proxy dialer #1162

Open
wants to merge 353 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
353 commits
Select commit Hold shift + click to select a range
7812cb7
feat: prepare to partially detach engine from netxlite (#1265)
bassosimone Sep 14, 2023
d1817c9
cleanup: inline NewHTTPTransportWithLoggerResolverAndOptionalProxyURL…
bassosimone Sep 14, 2023
f1f003a
refactor(netxlite): split http code into multiple files (#1267)
bassosimone Sep 14, 2023
263b486
chore(netxlite): isolate and annotate quirky functions (#1269)
bassosimone Sep 14, 2023
65eb0fd
feat(netxlite): add flexible HTTP transport factory (#1270)
bassosimone Sep 14, 2023
6c45c7f
chore: run go fmt ./... (#1272)
bassosimone Sep 15, 2023
b6a9d00
feat(testingx): introduce more comprehensive HTTP(S) proxy (#1274)
bassosimone Sep 15, 2023
fa35c9d
feat(testingproxy): test HTTP(S) proxies using netem (#1275)
bassosimone Sep 15, 2023
ad0e1b0
feat(testingx): more tests for NewHTTPProxyHandler (#1276)
bassosimone Sep 15, 2023
09bf5d8
cleanup: use testingx.NewHTTPProxyHandler as proxy (#1277)
bassosimone Sep 15, 2023
bdc7c59
feat(UnderlyingNetwork): add support for ListenTCP (#1278)
bassosimone Sep 15, 2023
2e87095
feat(netxlite): add (*Netx).ListenTCP (#1279)
bassosimone Sep 15, 2023
fe221a5
feat: support for testing socks5 clients (#1280)
bassosimone Sep 16, 2023
367b67d
refactor(model/netx.go): TLSHandhaker now returns a TLSConn (#1281)
bassosimone Sep 18, 2023
cdc717c
feat(enginenetx): support HTTP and HTTPS proxies (#1282)
bassosimone Sep 19, 2023
a17d298
feat(enginenetx): add configurable HTTPS dialer (#1283)
bassosimone Sep 20, 2023
0abb2ea
feat(testingx): add code to ensure we close all conns (#1284)
bassosimone Sep 20, 2023
236338b
feat(enginenetx): make sure HTTPSDialer closes all connections (#1285)
bassosimone Sep 20, 2023
3c92f1b
fix(enginenetx): pass context to tactics callbacks (#1286)
bassosimone Sep 20, 2023
5586866
refactor: adapt to netem pinning certificates to hosts (#1287)
bassosimone Sep 20, 2023
4072763
refactor(enginenetx): split https dialer implementation (#1289)
bassosimone Sep 21, 2023
bff5db7
feat(enginenetx): introduce loadable TLSDialer policy (#1290)
bassosimone Sep 21, 2023
6ce0847
refactor(enginenetx): introduce stats and make tactic a struct (#1291)
bassosimone Sep 21, 2023
c5107f7
fix(enginenetx): store endpoint into the tactic (#1292)
bassosimone Sep 21, 2023
145812e
refactor(enginenetx): rename HTTPTransport to Network (#1293)
bassosimone Sep 22, 2023
b394f7d
feat: add github.com/tailscale/hujson extensions (#1294)
bassosimone Sep 22, 2023
1a179ab
feat(enginenetx): use the new HTTPSDialer (#1295)
bassosimone Sep 22, 2023
2492145
fix(enginenetx): refine the happy-eyeballs algorithm (#1296)
bassosimone Sep 22, 2023
d9f1366
refactor(enginenetx): make static/loadable policy easier to use (#1297)
bassosimone Sep 22, 2023
7043e47
feat(enginenetx): honor user-provided policy (#1298)
bassosimone Sep 25, 2023
be76630
feat(enginenetx): track operations and collect stats (#1299)
bassosimone Sep 25, 2023
069705b
refactor(enginenetx): make LookupTactics async (#1300)
bassosimone Sep 25, 2023
a032484
fix(enginenetx): stabilize happy eyeballs algorithm (#1301)
bassosimone Sep 25, 2023
a99423b
feat(enginenetx): introduce beacons policy (#1302)
bassosimone Sep 26, 2023
546ccd6
refactor(enginenetx): make beacons API private (#1303)
bassosimone Sep 26, 2023
cfd7168
refactor(enginenetx): make stats API private (#1304)
bassosimone Sep 26, 2023
5fa7bd7
feat(enginenetx): prune old entries from stats (#1305)
bassosimone Sep 26, 2023
f4eb5af
refactor(enginenetx): store address and port separately (#1306)
bassosimone Sep 26, 2023
088b086
refactor(enginenetx): group by domain's endpoint (#1307)
bassosimone Sep 26, 2023
f6b3843
refactor(enginenetx): make static-policy API private (#1308)
bassosimone Sep 26, 2023
06820c9
refactor(enginenetx): make dns-policy API private (#1309)
bassosimone Sep 26, 2023
9c713e8
refactor(enginenetx): make https-dialer API private (#1310)
bassosimone Sep 26, 2023
74a025f
feat(enginenetx): support getting stats on a domain endpoint (#1311)
bassosimone Sep 26, 2023
18b383e
feat(enginenetx): add policy based on stats (#1312)
bassosimone Sep 26, 2023
519cce1
feat(enginenetx): enable the stats-based policy (#1313)
bassosimone Sep 26, 2023
217bbec
chore(enginenetx): more tests and robustness checks (#1314)
bassosimone Sep 26, 2023
b725a06
fix(enginenetx): use dns policy with proxy (+renames) (#1315)
bassosimone Sep 26, 2023
546d6f4
fix(enginenetx): gracefully handle more nil cases (#1316)
bassosimone Sep 27, 2023
8637821
fix(enginenetx): periodically trim statistics (#1317)
bassosimone Sep 27, 2023
6a78f5e
feat(enginenetx): extend beacons policy for THs (#1318)
bassosimone Sep 27, 2023
1df748b
refactor: move scrubbing logger to logx (#1319)
bassosimone Sep 27, 2023
65d1a18
refactor(scrubber): reorganize tests and expose ScrubBytes (#1320)
bassosimone Sep 28, 2023
ecd945a
feat(model): introduce ArchivalBinaryData (#1321)
bassosimone Sep 28, 2023
267780c
chore(model): add tests for ArchivalTLSOrQUICHandshakeResult (#1322)
bassosimone Sep 28, 2023
da20e69
refactor(model): simplify using ArchivalBinaryData (#1323)
bassosimone Sep 28, 2023
99b4a6a
cleanup(ArchivalTLSOrQUICHandshakeResult): use ArchivalBinaryData (#1…
bassosimone Sep 28, 2023
64154e0
feat: add ArchivalMaybeBinaryString type (#1325)
bassosimone Sep 28, 2023
2c515b5
chore: write tests for ArchivalDNSLookupResult (#1326)
bassosimone Sep 28, 2023
6614095
chore: write tests for ArchivalTCPConnectResult (#1327)
bassosimone Sep 28, 2023
bdc25c6
chore: write tests for ArchivalHTTPRequestResult (#1328)
bassosimone Sep 28, 2023
d6cbf84
chore: write tests for ArchivalNetworkEvent (#1329)
bassosimone Sep 28, 2023
e3e60d9
feat(ArchivalHTTPRequestResult): add tests w/ binary data and IP addr…
bassosimone Sep 28, 2023
6daa1e6
cleanup(model): use ArchivalMaybeBinaryString for HTTP bodies (#1331)
bassosimone Sep 28, 2023
7d6b30b
cleanup: common funcs for setting headers (#1332)
bassosimone Sep 28, 2023
d9652e4
cleanup: headers map now uses ArchivalMaybeBinaryString (#1333)
bassosimone Sep 28, 2023
aed7d71
refactor: use ArchivalMaybeBinaryString for headers list (#1334)
bassosimone Sep 28, 2023
99123e6
feat(archival): unconditionally scrub HTTP headers and bodies (#1335)
bassosimone Sep 28, 2023
21b8ef6
cleanup: move ArchivalMaybeBinaryData to legacymodel (#1336)
bassosimone Sep 28, 2023
4acfedc
chore: upgrade to Psiphon-Labs/psiphon-tunnel-core@3f91b1b (#1338)
bassosimone Oct 4, 2023
576d130
chore: use go1.20.8 (#1340)
bassosimone Oct 4, 2023
be7b768
chore: use 2023-10 geoip database (#1341)
bassosimone Oct 4, 2023
a674c6a
chore: use gomajor to update direct deps (#1342)
bassosimone Oct 4, 2023
1fb2502
chore: run go generate ./... (#1343)
bassosimone Oct 4, 2023
937f7e2
chore: update the user agent we use (#1344)
bassosimone Oct 4, 2023
99b6d88
chore: upgrade C dependencies (#1339)
bassosimone Oct 5, 2023
a2d7a2f
chore: upgrade the NDK version (#1345)
bassosimone Oct 5, 2023
406a11e
chore: upgrade most deps except snowflake (#1346)
bassosimone Oct 5, 2023
89c7385
chore: update obfs4, goptlib, snowflake (#1347)
bassosimone Oct 6, 2023
d425770
fix: update Snowflake domain front (#1337)
cohosh Oct 6, 2023
aeecd5d
fix: rename beacons to bridges (#1349)
bassosimone Oct 6, 2023
d2a9ed9
fix(quicping): support URLs with an IPv6 address (#1192)
Lanius-collaris Oct 6, 2023
7404aed
Readme.md: explictly mention go version
bassosimone Oct 6, 2023
7b6aa6d
fix(logx): log when an operation is starting (#1350)
bassosimone Oct 9, 2023
5bccd71
fix: make bootstrap more robust (and slower 😢) (#1351)
bassosimone Oct 9, 2023
a3a0eb7
refactor: go test -short does not use the host network (#1352)
bassosimone Oct 9, 2023
d437da0
fix(engineresolver): support HTTP/HTTPS proxies (#1353)
bassosimone Oct 9, 2023
7293b50
chore(oonimkall): re-enable TestTaskRunnerRun (#1354)
bassosimone Oct 10, 2023
6e9a9ac
fix: anomaly with android_dns_cache_no_data and inconsistent dns (#1211)
bassosimone Oct 10, 2023
5d4435d
chore: we're now hacking on v3.20.0-alpha (#1356)
bassosimone Oct 10, 2023
c395c75
feat: mvp of conditionally enabling experiments (#1355)
bassosimone Oct 11, 2023
f352783
fix(torsf): bump the version number (#1357)
bassosimone Oct 11, 2023
f5af9a7
feat: add echcheck to the experimental suite (#1217)
kelmenhorst Oct 11, 2023
ba7e913
fix(ooniprobe): make sure we actually run echcheck (#1358)
bassosimone Oct 11, 2023
39bf550
fix(registry): mark torsf as disabled by default (#1359)
bassosimone Oct 11, 2023
27d2b9a
cleanup(riseupvpn): remove summary keys (#1360)
bassosimone Oct 11, 2023
e95e8d8
refactor(riseupvpn): rename structs, change progress, bump version (#…
bassosimone Oct 11, 2023
6069871
chore: use go1.20.10 (#1362)
bassosimone Oct 11, 2023
3fec1d6
refactor(riseupvpn): handle failing API and simplify test keys (#1363)
bassosimone Oct 11, 2023
3f145a4
feat(riseupvpn): include bootstrap in progress (#1364)
bassosimone Oct 11, 2023
736e5e6
chore(ooniprobe): add riseupvpn to experimental test suite (#1365)
bassosimone Oct 11, 2023
60f5ca1
refactor(buildtool): use list for OpenSSL ./Configure flags (#1367)
bassosimone Oct 12, 2023
01a8f4b
cleanup(buildtool): disable unit tests when building tor (#1368)
bassosimone Oct 12, 2023
af3ee42
fix(buildtool): let libevent use OpenSSL's pkgconfig (#1369)
bassosimone Oct 12, 2023
e5306e9
feat(buildtool): build zlib, openssl, libevent, and tor for iOS (#1370)
bassosimone Oct 12, 2023
566d410
chore(buildtool): add ios-build unit tests (#1371)
bassosimone Oct 12, 2023
23e8fb5
feat(ios): replace go-libtor with ./internal/libtor (#1366)
bassosimone Oct 12, 2023
91e20fd
fix(ios): publish libcrypto, libssl, libevent, libtor, libz framework…
bassosimone Oct 16, 2023
6485c8b
fix(nettests): failing to start a nettest is a warning (#1373)
bassosimone Oct 18, 2023
2d709bc
fix(registry): disable vanilla_tor by default (#1374)
bassosimone Oct 19, 2023
1452293
chore: upgrade NDKVERSION to latest r26 (#1375)
bassosimone Oct 20, 2023
d1fa91c
refactor(dslx): allow running w/o measurexlite as the backend (#1376)
bassosimone Oct 20, 2023
6497f87
cleanup(dslx): use model.UnderlyingNetwork for testing (#1377)
bassosimone Oct 20, 2023
8bc336d
refactor(dslx): unify TLS and QUIC handshake options (#1378)
bassosimone Oct 25, 2023
7154467
refactor(dslx): start making functions stateless (#1379)
bassosimone Oct 25, 2023
8da6341
refactor(dslx): prepare for making HTTPRequest stateless (#1380)
bassosimone Oct 25, 2023
b429542
refactor(dslx): finish making funcs stateless (#1381)
bassosimone Oct 25, 2023
50c9a4e
refactor(dslx): pass Maybe[T] to Func.Apply (#1382)
bassosimone Oct 25, 2023
15f6ffd
dslx: post-Func.Apply(Maybe[T])-introduction cleanups (#1384)
bassosimone Oct 25, 2023
c55096b
refactor(dslx): collect observations using runtime (#1383)
bassosimone Oct 25, 2023
e6ed7a2
fix(dslx): remove Observations from Maybe (#1385)
bassosimone Oct 25, 2023
1239f54
refactor(dslx): type Operation func(context, A) (B, error) (#1386)
bassosimone Oct 25, 2023
55c7891
feat(dslx): implement DNSLookupParallel (#1387)
bassosimone Oct 25, 2023
84e1ad6
feat(dslx): introduce MeasureResolvedAddresses (#1388)
bassosimone Oct 25, 2023
99d2169
Update signal test endpoints fixes probe/2627 (#1389)
hellais Nov 21, 2023
6228893
chore: use 2023-11 geoip database (#1390)
bassosimone Nov 21, 2023
e01e0c5
chore: use go1.20.11 (#1391)
bassosimone Nov 22, 2023
9920cff
feat: minipipeline to analyze measurements (#1393)
bassosimone Nov 28, 2023
dd12ea5
feat: qatool to run webconnectivity lte QA (#1394)
bassosimone Nov 28, 2023
7e10550
fix(minipipeline): DNSLookupFailures must be a slice (#1395)
bassosimone Nov 28, 2023
c214d5e
refactor(webconnectivitylte): {Append,Prepend}Requests (#1396)
bassosimone Nov 28, 2023
0f556e5
feat(webconnectivityqa): add more QA tests (#1397)
bassosimone Nov 28, 2023
de44810
fix(webconnectivitylte): always save "connect" network events (#1398)
bassosimone Nov 28, 2023
412145f
chore(webconnectivitylte): sync {cleartext,secure}flow.go (#1399)
bassosimone Nov 28, 2023
de99ecf
cleanup(minipipeline): factor code into utility functions (#1400)
bassosimone Nov 28, 2023
2fc7125
fix(minipipeline/analysis): distinguish between None and empty (#1401)
bassosimone Nov 29, 2023
23a6844
feat(minipipeline): introduce "classic" observations filtering (#1402)
bassosimone Nov 29, 2023
e782a31
feat: add and process depth and fetch_body tags (#1403)
bassosimone Nov 29, 2023
e85c352
chore: regenerate testdata for minipipeline (#1404)
bassosimone Nov 29, 2023
75873f0
fix(minipipeline): include probe/control resolved addrs (#1405)
bassosimone Nov 30, 2023
b755ecd
cleanup(minipipeline/analysis): move utilities in other files (#1406)
bassosimone Nov 30, 2023
e509128
fix(minipipeline): change DNSDiff algorithm (#1407)
bassosimone Nov 30, 2023
98525dc
refactor(minipipeline): change DNSDiff foundations (#1408)
bassosimone Nov 30, 2023
62e47ec
refactor(minipipeline): adjust how we compute DNS failures (#1409)
bassosimone Nov 30, 2023
b710bb9
refactor(minipipeline): adjust how we compute TCP and TLS anomalies (…
bassosimone Nov 30, 2023
6792f2c
feat(minipipeline): distinguish failure by operation (#1411)
bassosimone Nov 30, 2023
9924da4
refactor(minipipeline): tweak how we detect HTTP failures (#1412)
bassosimone Nov 30, 2023
98d066b
refactor(minipipeline): separate unexplained tcp and tls failures (#1…
bassosimone Nov 30, 2023
784495d
refactor(minipipeline): tweak HTTP code (#1414)
bassosimone Nov 30, 2023
5ded144
feat(minipipeline): add metrics required by LTE compat analysis mode …
bassosimone Nov 30, 2023
7e5d98f
cleanup(minipipeline): zap DNSPossiblyNonexistingDomains metric (#1416)
bassosimone Nov 30, 2023
885905e
fix(minipipeline): don't emit fetch_body=false in classic mode (#1418)
bassosimone Nov 30, 2023
207db60
fix(minipipeline): set control expectation for all observations (#1419)
bassosimone Nov 30, 2023
ea297fc
feat(minipipeline): implement linear analysis (#1417)
bassosimone Nov 30, 2023
47b1fca
feat(webconnectivitylte): introduce classic analysis (#1420)
bassosimone Nov 30, 2023
c1d24c8
feat: make sure LTE and v0.4 emit the same test keys (#1392)
bassosimone Dec 1, 2023
6766140
fix(signal): trim down tested endpoints (#1421)
bassosimone Dec 1, 2023
70794a6
doc(webconnectivitylte): document "orig" HTTP analysis bug (#1422)
bassosimone Dec 1, 2023
a952d71
fix(oonimkall): make sure SoftwareName is set (#1425)
bassosimone Dec 12, 2023
540259a
chore: use 2023-12 database (#1426)
bassosimone Dec 12, 2023
cfb3a35
chore: use go1.20.12 (#1427)
bassosimone Dec 12, 2023
0dec1c7
chore: update user agent, reformat code, regenerate statics (#1429)
bassosimone Dec 13, 2023
aabfbce
chore: update easy-to-update deps (#1430)
bassosimone Dec 13, 2023
440b76f
chore: more easy to update deps (#1431)
bassosimone Dec 13, 2023
6ec6701
chore: upgrade netem and miekg/dns (#1432)
bassosimone Dec 13, 2023
7e71e8c
chore: update to quic-go@v0.40.1 (#1428)
bassosimone Dec 13, 2023
2bddee9
chore: try to upgrade all possible dependencies (#1433)
bassosimone Dec 13, 2023
bf7a9df
feat: allow go1.21 builds (#1424)
bassosimone Dec 13, 2023
b3c293d
fix: make sure we can parse integers from JSON (#1435)
bassosimone Dec 13, 2023
c81f9f3
cleanup(miniooni): rename kvstore2 to engine (#1436)
bassosimone Dec 13, 2023
e10302d
feat(miniooni): minimal JavaScript-ing capabilities (#1437)
bassosimone Dec 13, 2023
05547c4
cleanup: move dslx inside internal/x (#1438)
bassosimone Dec 13, 2023
02a32fb
chore: update C deps (#1434)
bassosimone Dec 13, 2023
a4554dc
chore: we're now hacking on v3.21.0-alpha (#1439)
bassosimone Dec 13, 2023
829876d
chore(deps): bump golang.org/x/crypto from 0.16.0 to 0.17.0 (#1441)
dependabot[bot] Dec 19, 2023
c986674
feat(oohelperd): protect against overload and add metrics (#1442)
bassosimone Dec 21, 2023
5f45449
chore(deps): bump github.com/cloudflare/circl from 1.3.6 to 1.3.7 (#1…
dependabot[bot] Jan 9, 2024
b5d5264
fix(dnsping): make output more actionable (#1444)
bassosimone Jan 12, 2024
fb08981
fix(libtor): prevent concurrent instances (#1445)
bassosimone Jan 16, 2024
d6239ef
refactor(webconnectivitylte): make analysis flags public (#1447)
bassosimone Jan 16, 2024
f5cd0c0
refactor(minipipeline): allow avoiding linear analysis (#1448)
bassosimone Jan 16, 2024
b9a76a6
feat(minipipeline): add DNSLookupSuccessWithBogonAddresses (#1449)
bassosimone Jan 16, 2024
dcb5d5a
chore(minipipeline): increase code coverage (#1450)
bassosimone Jan 16, 2024
99cf201
feat(minipipeline): add ControlFinalResponseExpectations (#1451)
bassosimone Jan 18, 2024
0aa3919
feat(minipipeline): add ControlFinalResponseExpectations (2/2) (#1452)
bassosimone Jan 19, 2024
2dc5c00
feat(minipipeline): add DNS and HTTP unexplained failures (#1453)
bassosimone Jan 19, 2024
140d18f
feat(webconnectivitylte): classic computes XBlockingFlags (#1446)
bassosimone Jan 19, 2024
18b694c
feat(webconnectivitylte): classic supports XNullNullFlags (#1454)
bassosimone Jan 19, 2024
4c81abe
cleanup(webconnectivitylte): remove the orig engine (#1455)
bassosimone Jan 19, 2024
0cb3a45
cleanup(webconnectivitytle): avoid code duplication (#1456)
bassosimone Jan 19, 2024
dbe10d3
feat(webconnectivitylte): handle ghost DNS censorship (#1457)
bassosimone Jan 22, 2024
f013db5
feat(webconnectivitylte): add more tests and comments (#1458)
bassosimone Jan 22, 2024
da656b3
minipipeline: fix expected TCP & TLS failures (#1459)
bassosimone Jan 22, 2024
f359fef
fix(webconnectivitylte): make IDNA WAI (#1460)
bassosimone Jan 23, 2024
940d6ae
chore(minipipeline): add test case for ooni/probe#2456 (#1461)
bassosimone Jan 23, 2024
a30eb55
fix(oohelperd): make sure endpoints don't connect to 127.0.0.1 (#1463)
bassosimone Jan 24, 2024
3ace615
fix(oohelperd,netemx): construct equivalent HTTPTransports (#1464)
bassosimone Jan 24, 2024
6973451
cleanup(netxlite): remove first-order implicit-Netx wrappers (#1465)
bassosimone Jan 24, 2024
87aafd5
refactor(oohelperd): depend on netxlite.Netx only (#1466)
bassosimone Jan 24, 2024
f944cf5
refactor(oohelperd,netmx): reduce construction diff to zero (#1467)
bassosimone Jan 24, 2024
669b27c
refactor(netemx,oohelperd): use oohelperd.NewHandler constructor (#1468)
bassosimone Jan 24, 2024
495c237
chore(minipipeline): regenerate test cases (#1469)
bassosimone Jan 24, 2024
d578149
fix(webconnectivitylte): handle measurements with loopback addrs (#1462)
bassosimone Jan 24, 2024
0cf610a
chore(minipipeline): add http://firefox.com test case (#1470)
bassosimone Jan 24, 2024
63d31d2
chore(minipipeline): add data to understand ooni/probe#1511 (#1471)
bassosimone Jan 24, 2024
51f2a0a
fix(minipipeline): handle IP-addr URLs in classic linear analysis (#1…
bassosimone Jan 24, 2024
37367b5
fix(webconnectivitylte): handle domains w/o A/AAAA records (#1473)
bassosimone Jan 24, 2024
ec19103
chore: use latest zlib version published (1.3.1) (#1477)
ainghazal Jan 29, 2024
e9414f9
doc(Readme.md): add link to miniooni (#1478)
bassosimone Jan 30, 2024
8daf64f
feat(webconnectivitylte): add Cloudflare CAPTCHA test cases (#1476)
bassosimone Jan 30, 2024
7b6cf3e
chore(webconnectivityqa): reproduce ooni/probe#2628 issue (#1479)
bassosimone Jan 31, 2024
ae80474
fix(webconnectivitylte): handle malformed redirect URLs (#1480)
bassosimone Jan 31, 2024
ef127a7
minipipeline: fix computing HTTPResponseBodyIsTruncated (#1481)
bassosimone Jan 31, 2024
e30e816
chore(webconnectivitylte): add large file test cases (#1475)
bassosimone Jan 31, 2024
c1ea612
chore(buildtool): support go1.18+ (#1483)
bassosimone Feb 1, 2024
e435d33
feat(buildtool): add the gofixpath subcommand (#1484)
bassosimone Feb 1, 2024
76ff37b
feat(buildtool): introduce script/go.bash wrapper (#1485)
bassosimone Feb 1, 2024
617aea6
feat(Makefile): use ./script/go.bash (#1482)
bassosimone Feb 1, 2024
71802a5
doc(Readme.md): mention ./script/go.bash (#1486)
bassosimone Feb 2, 2024
fa9d3c2
fix(script/go.bash): support Ubuntu 22.04 LTS and Debian 11 (#1487)
bassosimone Feb 2, 2024
acc4a47
fix(webconnectivitylte): count bytes sent and received (#1488)
bassosimone Feb 2, 2024
5d41159
feat(engineresolver): add wikimedia DNS (#1489)
bassosimone Feb 2, 2024
54ce48a
BREAKING CHANGE: feat: move StreamAllContext to netxlite (#1490)
bassosimone Feb 5, 2024
eeab472
cleanup(all): remove the run experiment (#1492)
bassosimone Feb 7, 2024
21db18c
refactor(all): improve SummaryKeys management (#1491)
bassosimone Feb 7, 2024
b964cd6
feat(webconnectivitylte): wire-in SummaryKeys (#1493)
bassosimone Feb 7, 2024
a2ea223
cleanup(Readme.md): remove redundant sentence
bassosimone Feb 8, 2024
b9ec11a
refactor(webconnectivitylte): use NewHTTPTransportWithOptions (#1494)
bassosimone Feb 8, 2024
013513c
doc(webconnectivitylte): clarify http_transaction_{start,end} semanti…
bassosimone Feb 8, 2024
1bec4e0
refactor: move webconnectivitylte algos to webconnectivityalgo (#1496)
bassosimone Feb 8, 2024
fed3ea1
feat(webconnectivityalgo): test OpportunisticDNSOverHTTPSURLProvider …
bassosimone Feb 8, 2024
21bcf7e
feat(webconnectivityalgo): test DNSWhoamiService (#1498)
bassosimone Feb 8, 2024
ab5a1cb
fix(DNSWhoamiService): implement cache expiration (#1499)
bassosimone Feb 8, 2024
2063d53
doc(Readme.md): mention nightly builds
bassosimone Feb 8, 2024
67d120c
feat(webconnectivitylte): use random DNS-over-UDP resolver (#1500)
bassosimone Feb 8, 2024
c980fc3
fix(CDEPS/tor): allow compiling under ArchLinux (#1501)
bassosimone Feb 8, 2024
3bf045e
fix(webconnectivitylte): include network events (#1503)
bassosimone Feb 9, 2024
68b2925
fix(webconnectivitylte): include client_resolver (#1504)
bassosimone Feb 9, 2024
56e034f
fix(qatool): reduce generated test cases churn (#1505)
bassosimone Feb 12, 2024
abe9779
fix(webconnectivitylte): never sort test keys (#1506)
bassosimone Feb 12, 2024
30d5a17
fix(webconnectivitylte): use scope for endpoint IDs (#1507)
bassosimone Feb 12, 2024
d0b85d0
fix(webconnectivitylte): don't use a DoH URL provider singleton (#1508)
bassosimone Feb 12, 2024
afb8a36
fix(minipipeline): sort A before AAAA (#1509)
bassosimone Feb 12, 2024
e3abb00
fix(qatool): normalize test keys (#1510)
bassosimone Feb 12, 2024
f9484b5
fix(qatool): make Date header constant (#1511)
bassosimone Feb 12, 2024
6e0e734
fix(qatool): do not save large response bodies on disk (#1512)
bassosimone Feb 13, 2024
edbb31c
fix(webconnectivitylte): add 10k*i scope to all IDs (#1513)
bassosimone Feb 13, 2024
970f89f
cleanup(netemx): simplify idna and large-file test cases (#1514)
bassosimone Feb 13, 2024
80a87a6
fix(qatool): remove remaining causes of churn (#1515)
bassosimone Feb 13, 2024
c6b0a2c
fix(webconnectivitylte): add classic and tcptls_experiment tags (#1502)
bassosimone Feb 13, 2024
b933f34
successfully run tests
Murphy-OrangeMud Jun 24, 2023
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
6 changes: 5 additions & 1 deletion internal/netxlite/dialer.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"context"
"errors"
"net"
"reflect"
"sync"
"time"

Expand Down Expand Up @@ -222,7 +223,10 @@ func (d *dialerResolverWithTracing) DialContext(ctx context.Context, network, ad
err = MaybeNewErrWrapper(ClassifyGenericError, ConnectOperation, err)
trace.OnConnectDone(started, network, onlyhost, target, err, finished)
if err == nil {
conn = &dialerErrWrapperConn{conn}
for reflect.TypeOf(conn).ConvertibleTo(reflect.TypeOf(&dialerErrWrapperConn{})) {
conn = conn.(*dialerErrWrapperConn).Conn
}
conn = &dialerErrWrapperConn{Conn: conn}
Copy link
Contributor

@bassosimone bassosimone Oct 9, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code is very fragile and assumes that we're creating a specific chain of wrappers. I'd rather try to rewrite the pull request such that we avoid using this code entirely. My understanding is that you don't want to wrap the connection more than once. Wrapping multiple times should be fine, but probably it's also possible to avoid wrapping by using a model.UnderlyingNetwork, which provides a dialer that, in the common case, is the standard library dialer.

return trace.MaybeWrapNetConn(conn), nil
}
errorslist = append(errorslist, err)
Expand Down
222 changes: 222 additions & 0 deletions internal/netxlite/httpproxy.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,222 @@
package netxlite

import (
"context"
"errors"
"fmt"
"github.com/ooni/probe-cli/v3/internal/model"
"golang.org/x/net/proxy"
"net"
"net/http"
"strconv"
"strings"
"time"
)

// A HttpDialer holds HTTP-specific options
// Specifically for HTTP proxy, we build an HTTP tunnel
type HttpDialer struct {
Murphy-OrangeMud marked this conversation as resolved.
Show resolved Hide resolved
proxy.Dialer
proxyNetwork string
proxyAddress string
timeout time.Duration
ProxyDial func(context.Context, string, string) (net.Conn, error)
}

func (d *HttpDialer) Dial(network, address string) (net.Conn, error) {
Murphy-OrangeMud marked this conversation as resolved.
Show resolved Hide resolved
if err := d.validateTarget(network, address); err != nil {
proxy, dst, _ := d.pathAddrs(address)
return nil, &net.OpError{Op: http.MethodConnect, Net: network, Source: proxy, Addr: dst, Err: err}
}
var err error
var c net.Conn

if d.ProxyDial != nil {
c, err = d.ProxyDial(context.Background(), d.proxyNetwork, d.proxyAddress)
} else {
nd := &net.Dialer{Timeout: d.timeout}
c, err = nd.DialContext(context.Background(), d.proxyNetwork, d.proxyAddress)
}

if err != nil {
proxy, dst, _ := d.pathAddrs(address)
return nil, &net.OpError{Op: http.MethodConnect, Net: network, Source: proxy, Addr: dst, Err: err}
}
if err := d.DialWithConn(context.Background(), c, network, address); err != nil {
c.Close()
return nil, err
}
return c, nil
}

func (d *HttpDialer) validateTarget(network, address string) error {
Murphy-OrangeMud marked this conversation as resolved.
Show resolved Hide resolved
switch network {
case "tcp", "tcp6", "tcp4":
default:
return errors.New("network not implemented")
}
return nil
}

type Addr struct {
Murphy-OrangeMud marked this conversation as resolved.
Show resolved Hide resolved
network string
Name string // fully-qualified domain name
IP net.IP
Port int
}

func (a *Addr) Network() string { return a.network }

func (a *Addr) String() string {
if a == nil {
return "<nil>"
}
port := strconv.Itoa(a.Port)
if a.IP == nil {
return net.JoinHostPort(a.Name, port)
}
return net.JoinHostPort(a.IP.String(), port)
}

func splitHostPort(address string) (string, int, error) {
host, port, err := net.SplitHostPort(address)
if err != nil {
return "", 0, err
}
portnum, err := strconv.Atoi(port)
if err != nil {
return "", 0, err
}
if 1 > portnum || portnum > 0xffff {
return "", 0, errors.New("port number out of range " + port)
}
return host, portnum, nil
}

func (d *HttpDialer) pathAddrs(address string) (proxy, dst net.Addr, err error) {
for i, s := range []string{d.proxyAddress, address} {
host, port, err := splitHostPort(s)
if err != nil {
return nil, nil, err
}
a := &Addr{Port: port}
a.IP = net.ParseIP(host)
if a.IP == nil {
a.Name = host
}
if i == 0 {
proxy = a
} else {
dst = a
}
}
return
}

func (d *HttpDialer) DialWithConn(ctx context.Context, c net.Conn, network, address string) error {
Murphy-OrangeMud marked this conversation as resolved.
Show resolved Hide resolved
if err := d.validateTarget(network, address); err != nil {
proxy, dst, _ := d.pathAddrs(address)
return &net.OpError{Op: http.MethodConnect, Net: network, Source: proxy, Addr: dst, Err: err}
}
if ctx == nil {
proxy, dst, _ := d.pathAddrs(address)
return &net.OpError{Op: http.MethodConnect, Net: network, Source: proxy, Addr: dst, Err: errors.New("nil context")}
}

connectReq := fmt.Sprintf("%v %v HTTP/1.1\r\n"+
"Host: %v\r\n"+
"Proxy-Connection: keep-alive\r\n"+
"User-Agent: %v\r\n\r\n", http.MethodConnect, address, address, model.HTTPHeaderUserAgent)

b := []byte(connectReq)

n, err := c.Write(b)
if err != nil {
proxy, dst, _ := d.pathAddrs(address)
return &net.OpError{Op: http.MethodConnect, Net: network, Source: proxy, Addr: dst, Err: err}
}
if n != len(b) {
proxy, dst, _ := d.pathAddrs(address)
return &net.OpError{Op: http.MethodConnect, Net: network, Source: proxy, Addr: dst, Err: errors.New("not write enough bytes")}
}

c.Read(b)
if err != nil {
proxy, dst, _ := d.pathAddrs(address)
return &net.OpError{Op: http.MethodConnect, Net: network, Source: proxy, Addr: dst, Err: err}
}

str := string(b)
if strings.Split(str, " ")[1] != "200" {
proxy, dst, _ := d.pathAddrs(address)
return &net.OpError{Op: http.MethodConnect, Net: network, Source: proxy, Addr: dst, Err: errors.New("cannot establish connection")}
}

return nil
}

func (d *HttpDialer) DialContext(ctx context.Context, network, address string) (net.Conn, error) {
Murphy-OrangeMud marked this conversation as resolved.
Show resolved Hide resolved
if err := d.validateTarget(network, address); err != nil {
Murphy-OrangeMud marked this conversation as resolved.
Show resolved Hide resolved
proxy, dst, _ := d.pathAddrs(address)
return nil, &net.OpError{Op: http.MethodConnect, Net: network, Source: proxy, Addr: dst, Err: err}
Murphy-OrangeMud marked this conversation as resolved.
Show resolved Hide resolved
}
if ctx == nil {
proxy, dst, _ := d.pathAddrs(address)
return nil, &net.OpError{Op: http.MethodConnect, Net: network, Source: proxy, Addr: dst, Err: errors.New("nil context")}
}
Murphy-OrangeMud marked this conversation as resolved.
Show resolved Hide resolved

// proxy dial
var err error
var c net.Conn
Murphy-OrangeMud marked this conversation as resolved.
Show resolved Hide resolved

if d.ProxyDial != nil {
c, err = d.ProxyDial(ctx, d.proxyNetwork, d.proxyAddress)
} else {
nd := &net.Dialer{Timeout: d.timeout}
c, err = nd.DialContext(ctx, d.proxyNetwork, d.proxyAddress)
}
if err != nil {
proxy, dst, _ := d.pathAddrs(address)
return nil, &net.OpError{Op: http.MethodConnect, Net: network, Source: proxy, Addr: dst, Err: err}
}

connectReq := fmt.Sprintf("%v %v HTTP/1.1\r\n"+
"Host: %v\r\n"+
"Proxy-Connection: keep-alive\r\n"+
"User-Agent: %v\r\n\r\n", http.MethodConnect, address, address, model.HTTPHeaderUserAgent)

b := []byte(connectReq)
Murphy-OrangeMud marked this conversation as resolved.
Show resolved Hide resolved

n, err := c.Write(b)
Murphy-OrangeMud marked this conversation as resolved.
Show resolved Hide resolved
if err != nil {
proxy, dst, _ := d.pathAddrs(address)
return nil, &net.OpError{Op: http.MethodConnect, Net: network, Source: proxy, Addr: dst, Err: err}
}
if n != len(b) {
Murphy-OrangeMud marked this conversation as resolved.
Show resolved Hide resolved
proxy, dst, _ := d.pathAddrs(address)
return nil, &net.OpError{Op: http.MethodConnect, Net: network, Source: proxy, Addr: dst, Err: errors.New("not write enough bytes")}
}

c.Read(b)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems wrong since you're not checking for an error or the amount of bytes read here.

if err != nil {
proxy, dst, _ := d.pathAddrs(address)
return nil, &net.OpError{Op: http.MethodConnect, Net: network, Source: proxy, Addr: dst, Err: err}
}

str := string(b)
if strings.Split(str, " ")[1] != "200" {
proxy, dst, _ := d.pathAddrs(address)
return nil, &net.OpError{Op: http.MethodConnect, Net: network, Source: proxy, Addr: dst, Err: errors.New("cannot establish connection")}
}
Murphy-OrangeMud marked this conversation as resolved.
Show resolved Hide resolved

return c, nil

}

func NewHTTPDialer(network, address string) *HttpDialer {
return &HttpDialer{
proxyNetwork: network,
proxyAddress: address,
timeout: dialerDefaultTimeout,
}
}
102 changes: 102 additions & 0 deletions internal/netxlite/httpproxy_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
package netxlite

import (
"context"
"errors"
"fmt"
"net"
"net/http"
"testing"
)

func TestHTTPProxyDialer(t *testing.T) {
// REMINDER: This test need a http proxy running locally
dialer := NewHTTPDialer("tcp", "localhost:7890")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We recently added support for proxies in the ./internal/testingx package. I think you may want to take advantage of that for writing tests that always use a known working HTTP/HTTPS proxy.

t.Run("DialContextSuccess", func(t *testing.T) {
conn, err := dialer.DialContext(context.Background(), "tcp", "google.com:443")
if err != nil {
t.Fatal(fmt.Sprintf("unexpected error: %v", err))
}
if conn == nil {
t.Fatal("unexpected nil connection")
}
})

t.Run("DialSuccess", func(t *testing.T) {
conn, err := dialer.Dial("tcp", "google.com:443")
if err != nil {
t.Fatal(fmt.Sprintf("unexpected error: %v", err))
}
if conn == nil {
t.Fatal("unexpected nil connection")
}
})

t.Run("DialContextInvalidNetwork", func(t *testing.T) {
expected := errors.New("network not implemented")
conn, err := dialer.DialContext(context.Background(), "udp", "google.com:443")
if conn != nil {
t.Fatal("unexpected connection")
}
if err.(*net.OpError).Err.Error() != expected.Error() {
t.Fatal(fmt.Sprintf("unexpected error: %v", err))
}
})

t.Run("DialInvalidNetwork", func(t *testing.T) {
expected := errors.New("network not implemented")
conn, err := dialer.Dial("udp", "google.com:443")
if conn != nil {
t.Fatal("unexpected connection")
}
if err.(*net.OpError).Err.Error() != expected.Error() {
t.Fatal(fmt.Sprintf("unexpected error: %v", err))
}
})
}

func TestHTTPProxyDialerFailure(t *testing.T) {
dialer := NewHTTPDialer("tcp", "localhost:8888")
go func() {
listener, err := net.Listen("tcp", "localhost:8888")
defer listener.Close()
if err != nil {
t.Error(fmt.Sprintf("error: listen failed%v", err))
return
}
err = http.Serve(listener, http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
if r.Method == http.MethodConnect {
w.WriteHeader(500)
return
} else {
t.Error("error: unexpected request")
return
}
}))
}()
t.Run("DialContextFailure", func(t *testing.T) {
expected := errors.New("cannot establish connection")

conn, err := dialer.DialContext(context.Background(), "tcp", "google.com:443")
if conn != nil {
t.Fatal("unexpected connection")
}
if err.(*net.OpError).Err.Error() != expected.Error() {
t.Fatal("unexpected error")
}
})

t.Run("DialFailure", func(t *testing.T) {
expected := errors.New("cannot establish connection")

conn, err := dialer.Dial("tcp", "google.com:443")
if conn != nil {
t.Fatal("unexpected connection")
}
if err.(*net.OpError).Err.Error() != expected.Error() {
t.Fatal(fmt.Sprintf("unexpected error: %v", err))
}
})

return
Murphy-OrangeMud marked this conversation as resolved.
Show resolved Hide resolved
}
15 changes: 11 additions & 4 deletions internal/netxlite/maybeproxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,19 @@ var ErrProxyUnsupportedScheme = errors.New("proxy: unsupported scheme")
// DialContext implements Dialer.DialContext.
func (d *proxyDialer) DialContext(ctx context.Context, network, address string) (net.Conn, error) {
url := d.ProxyURL
if url.Scheme != "socks5" {
if url.Scheme == "socks5" {
// the code at proxy/socks5.go never fails; see https://git.io/JfJ4g
child, _ := proxy.SOCKS5(network, url.Host, nil, &proxyDialerWrapper{d.Dialer})
return d.dial(ctx, child, network, address)
} else if url.Scheme == "http" {
child := NewHTTPDialer(network, url.Host)
child.ProxyDial = func(ctx context.Context, network string, address string) (net.Conn, error) {
return d.Dialer.(proxy.ContextDialer).DialContext(ctx, network, address)
}
return d.dial(ctx, child, network, address)
} else {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few comments here:

  1. in terms of functionality, the PR claims support for "https" proxies, but here I only see support for "http"

  2. I would be happier if we could use a map with key the URL scheme and value the function to invoke depending on the URL scheme (I like this pattern more than using a chain of if)

  3. additionally, FYI, I like code to avoid using a else if and else when the previous if clause terminates with a return.

return nil, ErrProxyUnsupportedScheme
}
// the code at proxy/socks5.go never fails; see https://git.io/JfJ4g
child, _ := proxy.SOCKS5(network, url.Host, nil, &proxyDialerWrapper{d.Dialer})
return d.dial(ctx, child, network, address)
}

func (d *proxyDialer) dial(
Expand Down