Enable WebTorrent: wss:// trackers + WebRTC browser peers (#18) - #22
Merged
Conversation
Switch libs/libtorrent from RC_2_0 (2.0.13) to RC_2_1 (v2.1.0 + 122 bugfix commits). Groundwork for WebTorrent support (#18): 2.1 ships the WebRTC/WebSocket-tracker code, kept disabled for now (webtorrent=OFF) until the libdatachannel + TLS toolchain work lands. No JNI changes needed; RC_2_1 adds deps/libdatachannel and deps/asio-gnutls submodules (only built when webtorrent=ON).
New Sample Torrents row pointing at the same Sintel torrent through the modern WebTorrent trackers (tracker.webtorrent.dev, openwebtorrent.com, btorrent.xyz) plus the webtorrent.io web seed. Groundwork for #18: once the engine is built with webtorrent=ON this row demonstrates sharing with browser peers; until then it still downloads via DHT.
Browser-peer sharing isn't live until the engine builds with webtorrent=ON; don't claim it in the UI yet.
Flip webtorrent=ON and encryption=ON in the native build, backed by a static OpenSSL 3.5.7 built for Android by scripts/build-openssl-android.sh (arm64-v8a + x86_64, gitignored output, cached in CI). - Submodule moves to fork branch RC_2_1-simpletorrent: RC_2_1 plus one patch that loads the CA bundle named by SSL_CERT_FILE explicitly — asio's set_default_verify_paths() leaves the store empty with a static OpenSSL on Android, so wss:// certificate validation failed. - JNI exports the Android system trust store (conscrypt APEX or /system/etc/security/cacerts) as a single PEM bundle at session init and points SSL_CERT_FILE at it. - Debug builds now log libtorrent session/torrent log alerts to logcat (tag "libtorrent"), which is how the CA failure was diagnosed. - CI builds OpenSSL (actions/cache keyed on version) in the four jobs that compile native code. - New SampleTorrentsTest covers magnet well-formedness and the wss://-only WebTorrent sample. Verified end-to-end on the emulator: announces to wss://tracker.webtorrent.dev and openwebtorrent.com succeed, browser peers' answers arrive, RTC data channels open, and a WebRTC-only WebTorrent client (DHT/TCP disabled) downloaded Sintel from the app at 1.3 MB/s over a webrtc wire (peer id -LT2100-). Known quirk: the first announce right after session start can be canceled by the initial external-IP discovery; the retry 120 s later succeeds.
The pull_request branch filter matches the PR base, so stacked PRs (like webtorrent -> libtorrent-2.1) got no CI at all.
Closed
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stage 2 of WebTorrent support (#18) — stacked on #21 (libtorrent 2.1 bump). Verified working end-to-end; leaving #18 open until it's confirmed on master.
What's enabled
webtorrent=ON+encryption=ONin the native build: the app announces towss://WebSocket trackers and connects to WebTorrent (browser) peers over WebRTC data channels (libdatachannel + libjuice + usrsctp, statically linked).scripts/build-openssl-android.sh(arm64-v8a + x86_64; output gitignored; CI builds it with an actions/cache keyed on version in the four native-build jobs)./system/etc/security/cacerts) as one PEM bundle at session init and pointsSSL_CERT_FILEat it.RC_2_1-simpletorrent= RC_2_1 + one upstreamable patch: load theSSL_CERT_FILEbundle explicitly (asio'sset_default_verify_paths()leaves the store empty with a static OpenSSL on Android →certificate verify failedon every wss handshake).libtorrent) — this is how the CA issue was found.SampleTorrentsTest(4 tests): magnet well-formedness, wss-only trackers on the WebTorrent sample, shared infohash with plain Sintel, distinct hashes elsewhere.Verification
wss://tracker.webtorrent.devandwss://tracker.openwebtorrent.com.Known quirk
The first wss announce right after session start is sometimes canceled by libtorrent's initial external-IP discovery; the retry ~120 s later succeeds. Tracked for a possible follow-up (force re-announce once the external address settles).