Skip to content

Add optional YouTube relay mode (bypass SNI rewrite) - #55

Closed
ghost wants to merge 2 commits into
mainfrom
unknown repository
Closed

ghost wants to merge 2 commits into
mainfrom
unknown repository

Conversation

@ghost

@ghost ghost commented Apr 23, 2026 •

Copy link
Copy Markdown

Summary

YouTube was going through the same direct Google SNI-rewrite path as the main Google host list. In practice the TLS SNI doesn’t look like a normal YouTube hostname, and some people see weird behavior (restricted
mode, sign-in quirks, etc.).

This adds an opt-in: skip_youtube_sni_rewrite. When enabled, the YouTube-related suffixes (youtube.com, youtu.be, ytimg.com, …) are not matched for the SNI-rewrite tunnel and fall back to the Apps Script relay
instead, so the visible TLS identity matches the site. Tradeoff: likely slower for video, but more predictable for YouTube.

  • UI : new checkbox in settings — “Send YouTube through relay (no SNI rewrite)” — with a short tooltip explaining the tradeoff.

  • Code: SNI lists split into “core” Google (unchanged) vs YouTube; YouTube is only added to the rewrite path when the new flag is off (default is off, so existing behavior stays the same unless the user turns it on).

@Feiabyte

Copy link
Copy Markdown

yes I was gonna make an issue for this. this problem is present in the original version of the script (MasterHttpRelayVPN). if you've managed to fix it and if it gets merged with the project it would be great

@therealaleph

Copy link
Copy Markdown
Owner

Thanks for the contribution — not merging this one for a couple of reasons:

  1. .cargo/config.toml + zig-cc-aarch64-apple-darwin.sh: these are local cross-compile helpers for your machine (x86_64-w64-mingw32-gcc, /opt/zig-linux-x86_64-0.14.0/zig). Committing them to the repo would break our actual CI cross-compiles, which use a different matrix (dtolnay/rust-toolchain + msys2 for Windows GNU, macos-latest runners for aarch64-apple-darwin). The repo shouldn't carry anyone's per-machine build paths.

  2. Category mix-up: the PR moves doubleclick.net, googlesyndication.com, googleadservices.com, google-analytics.com, googletagmanager.com, googletagservices.com into SNI_REWRITE_YOUTUBE_SUFFIXES. They're ads/analytics, not YouTube — grouping them under a skip_youtube_sni_rewrite toggle means anyone who flips the YouTube escape-hatch for video playback reasons also loses direct routing for the ads/analytics domains, which doesn't match the option's description.

  3. Premise: the TLS SNI is rewritten to the front domain (www.google.com by default); the cert served by the GFE covers *.youtube.com and the HTTP Host header routes inside. That's how the Python upstream does it too, and we've never seen restricted-mode reports tied to this path. If you have a specific case where YouTube breaks, please open an issue with the logcat/logs — we'll take a look.

Closing — feel free to reopen with the .cargo/config.toml bits stripped and the ads/analytics suffixes kept in core.

therealaleph added a commit that referenced this pull request Apr 23, 2026
…only (#60)

Contains the three safety fixes from PRs #48/#49/#50 and the Persian
README RTL polishing from #58, all squashed into main. Merge details
already in their individual PR comments; summary:

  #48: reject truncated Content-Length relay responses (previously
       silently accepted whatever bytes arrived before EOF)
  #49: reject truncated or malformed (missing CRLF) chunked-encoding
       relay responses (same class of silent-acceptance bug)
  #50: restrict the SNI-rewrite tunnel dispatch to port 443. Plain
       HTTP (:80) targets that happened to match google.com / hosts
       override were being steered into the TLS tunnel and blocking
       waiting for a ClientHello that would never arrive.
  #58: trailing-whitespace line-breaks on Persian bullet lists in
       README so the RTL rendering doesn't collapse consecutive
       items into a single paragraph.

Test suite grew from 54 to 58 passing (three new negative tests for
the relay-reader correctness fixes + one SNI-rewrite port filter).

Telegram CI notify default switched to file-plus-link:
  - script gains a `--with-changelog` flag; default OFF
  - workflow only passes it when `vars.TELEGRAM_INCLUDE_CHANGELOG=true`
  - every routine release now posts just the APK + short caption
    (title + SHA-256 + repo URL + release URL) with no long body

To include bullets for a given release again:
  gh variable set TELEGRAM_INCLUDE_CHANGELOG --body true
The existing `vars.TELEGRAM_NOTIFY_ENABLED` job-level gate remains —
changelog toggle is orthogonal to enable/disable.

Also closes PR #55 without merging; ads/analytics domains were being
lumped under a YouTube-specific toggle, and the PR committed per-
machine \`.cargo/config.toml\` + zig-cc cross-compile helpers that
would have broken CI on actual Windows / macOS runners.
@Feiabyte Feiabyte mentioned this pull request Apr 23, 2026
@ghost ghost mentioned this pull request Apr 24, 2026
therealaleph added a commit that referenced this pull request Apr 25, 2026
…only (#60)

Contains the three safety fixes from PRs #48/#49/#50 and the Persian
README RTL polishing from #58, all squashed into main. Merge details
already in their individual PR comments; summary:

  #48: reject truncated Content-Length relay responses (previously
       silently accepted whatever bytes arrived before EOF)
  #49: reject truncated or malformed (missing CRLF) chunked-encoding
       relay responses (same class of silent-acceptance bug)
  #50: restrict the SNI-rewrite tunnel dispatch to port 443. Plain
       HTTP (:80) targets that happened to match google.com / hosts
       override were being steered into the TLS tunnel and blocking
       waiting for a ClientHello that would never arrive.
  #58: trailing-whitespace line-breaks on Persian bullet lists in
       README so the RTL rendering doesn't collapse consecutive
       items into a single paragraph.

Test suite grew from 54 to 58 passing (three new negative tests for
the relay-reader correctness fixes + one SNI-rewrite port filter).

Telegram CI notify default switched to file-plus-link:
  - script gains a `--with-changelog` flag; default OFF
  - workflow only passes it when `vars.TELEGRAM_INCLUDE_CHANGELOG=true`
  - every routine release now posts just the APK + short caption
    (title + SHA-256 + repo URL + release URL) with no long body

To include bullets for a given release again:
  gh variable set TELEGRAM_INCLUDE_CHANGELOG --body true
The existing `vars.TELEGRAM_NOTIFY_ENABLED` job-level gate remains —
changelog toggle is orthogonal to enable/disable.

Also closes PR #55 without merging; ads/analytics domains were being
lumped under a YouTube-specific toggle, and the PR committed per-
machine \`.cargo/config.toml\` + zig-cc cross-compile helpers that
would have broken CI on actual Windows / macOS runners.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants