mirror of
https://github.com/therealaleph/MasterHttpRelayVPN-RUST.git
synced 2026-05-18 06:34:41 +03:00
680502759a
The desktop UI now has a single "Share with other devices on my Wi-Fi / network" checkbox in place of the cryptic `listen_host: 0.0.0.0` text field. When enabled: - Bind auto-flips to 0.0.0.0 - LAN IP is detected via the standard UDP-connect trick (no actual traffic) and shown alongside the proxy ports for handing to the guest device - Tooltip explains macOS Firewall prompt behavior - A pre-existing custom bind IP in config.json is preserved with a "Custom bind: ..." badge so the next Save can't clobber it New `src/lan_utils.rs` module with detect_lan_ip / is_share_on_lan / is_loopback_only helpers (3 unit tests). Also rolls in the v1.9.6 changes (release was cancelled before binaries shipped): - Code.gs / CodeFull.gs: removed duplicate doGet, switched HtmlService -> ContentService, stripped X-Forwarded-* family in SKIP_HEADERS, added SAFE_REPLAY_METHODS fallback when fetchAll throws as a whole. - Rust client: parse_relay_json now unwraps goog.script.init iframe wrappers (defense-in-depth for legacy deployments or redirect-induced GET-on-doGet). - README rewritten as a short bilingual landing page; advanced reference moved to docs/guide.md + docs/guide.fa.md. Persian guide's `[x]` task list replaced with a table because GitHub's RTL renderer mangles checkbox positions inside `<div dir="rtl">`. Tests: 6 new regression tests (3 goog.script.init unwrap + 3 lan_utils). 179 lib + 33 tunnel-node tests all passing. Bind on 0.0.0.0 smoke-tested via lsof. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
7.8 KiB
7.8 KiB
• چکباکس «Share with other devices on my Wi-Fi / network» به UI دسکتاپ اضافه شد. بهجای اینکه کاربر listen_host را بهصورت دستی روی 0.0.0.0 تنظیم کند (که اکثر کاربران نمیدانستند)، حالا فقط یک چکباکس ساده روی فرم اصلی است. وقتی روشن میشود:
- Bind بهطور خودکار به
0.0.0.0تغییر میکند (تمام interfaceها) - IP محلی شبکهات با
detect_lan_ip()تشخیص داده میشود (یک trick UDPconnectکه از kernel میپرسد source-IP outbound کدام است — هیچ ترافیک شبکهای واقعی فرستاده نمیشود) و در زیر چکباکس همراه با پورتها نمایش داده میشود تا بتوانی مستقیم به گوشی / لپتاپ مهمان بدهی:Other devices: HTTP 192.168.x.y:8085 · SOCKS5 192.168.x.y:8086 - tooltip توضیح میدهد macOS اولین بار prompt firewall میاندازد
- اگر کاربر از قبل یک bind IP خاص (مثلاً
192.168.1.50یک NIC مشخص) درconfig.jsonنوشته باشد، چکباکس قفل میشود + برچسب «Custom bind: 192.168.1.50» نشان میدهد تا تنظیم دستی توسط Save بعدی پاک نشود. ماژول جدیدsrc/lan_utils.rsبا ۳ تست (تشخیص wildcard، تشخیص loopback، تست detect واقعی). • Code.gs / CodeFull.gs hardening + باگفیکس (هیچ تغییری در کانفیگ کاربر لازم نیست — فقط Code.gs خودتان را باassets/apps_script/Code.gs(یاCodeFull.gsبرای حالت full) جایگزین کنید + در Apps Script editor:Manage deployments → ✏️ → Version: New version → Deploy. Deployment ID همان قبلی میماند): Code.gsdoGet تکراری حذف شد: نسخهای که باHtmlService.createHtmlOutputتعریف شده بود بهخاطر hoisting جاوااسکریپت روی نسخهٔ صحیحContentServiceoverwrite میکرد. در نتیجه هر GET به URL deployment پاسخ سندباکسgoog.script.initiframe برمیگرداند بهجای HTML پلیسهولدر ساده.CodeFull.gsdoGetبهContentServiceتغییر کرد (قبلاًHtmlServiceبود) — به همان دلیل بالا.- هدرهای IP-leak در
SKIP_HEADERSاضافه شد (X-Forwarded-For,X-Forwarded-Host,X-Forwarded-Proto,X-Forwarded-Port,X-Real-IP,Forwarded,Via) — لایهٔ دفاع دوم به stripping سمت کلاینت v1.2.9 (#104). _doBatchدارای fallback شد: اگرUrlFetchApp.fetchAll()بهعنوان یک کل throw کند، حالا برای متدهای امن (GET / HEAD / OPTIONS) per-item fetch میکند بهجای صفر کردن کل پاسخ batch. port ازmasterking32/MasterHttpRelayVPN@3094288. •parse_relay_json(سمت Rust): unwrapper برایgoog.script.init("...userHtml...")اضافه شد — اگر هر deploymentای پاسخ HtmlService-wrapped برگرداند (legacy Code.gs قبل از v1.9.6، یا redirect که doGet را GET بزند)، client حالا JSON داخلی را استخراج میکند بهجای fail کردن باkey must be a string at line 2 column 1. • README بازنویسی شد: نسخهٔ کوتاه دوزبانه (انگلیسی + فارسی RTL) برای کاربر معمولی + راهنمای کامل پیشرفته درdocs/guide.mdوdocs/guide.fa.md. جدا کردن "راهاندازی ۵ دقیقهای" از "همهٔ گزینهها و troubleshooting" راهنما را خیلی قابلفهمتر کرد. در guide.fa.md task list با[x]با جدول جایگزین شد چون رندر RTL در GitHub با چکباکس مارکداون خراب میشد. • تست: ۶ regression test جدید (۳ برای unwrap goog.script.init + ۳ برای lan_utils). ۱۷۹ lib test + ۳۳ tunnel-node test همه pass.
• Added a "Share with other devices on my Wi-Fi / network" checkbox to the desktop UI. Instead of asking users to know they can set listen_host to 0.0.0.0 (which almost no one did), it's now a single checkbox on the main form. When enabled:
- Bind address auto-flips to
0.0.0.0(all interfaces) - Your LAN IP is detected via
detect_lan_ip()(UDPconnecttrick — asks the kernel which source IP it would use for an outbound packet, no actual network traffic sent) and shown alongside the proxy ports so you can hand them to the guest device directly:Other devices: HTTP 192.168.x.y:8085 · SOCKS5 192.168.x.y:8086 - Tooltip explains macOS will pop a Firewall prompt the first time
- If you've already written a specific bind IP (e.g.
192.168.1.50for one NIC) intoconfig.json, the checkbox locks itself and shows a "Custom bind: 192.168.1.50" badge so the next Save can't clobber your manual setting. Newsrc/lan_utils.rsmodule with 3 unit tests (wildcard detection, loopback detection, live detect smoke). • Code.gs / CodeFull.gs hardening + bug fixes (no client config change needed — just replace your own Code.gs withassets/apps_script/Code.gs(orCodeFull.gsfor full mode) and in the Apps Script editor:Manage deployments → ✏️ → Version: New version → Deploy. Your Deployment ID stays the same): - Removed duplicate
doGetinCode.gs: a second copy declared withHtmlService.createHtmlOutputwas silently overriding the correctContentServiceone due to JS function hoisting. Result: every GET to the deployment URL was returning thegoog.script.initsandbox iframe instead of the simple placeholder HTML. CodeFull.gsdoGetswitched toContentService(wasHtmlService) — same reason as above.- Added IP-leak headers to
SKIP_HEADERS(X-Forwarded-For,X-Forwarded-Host,X-Forwarded-Proto,X-Forwarded-Port,X-Real-IP,Forwarded,Via) — second line of defense to v1.2.9's client-side stripping (#104). _doBatchgot a fallback path: ifUrlFetchApp.fetchAll()throws as a whole, it now per-item-fetches safe methods (GET / HEAD / OPTIONS) instead of zeroing the entire batch's responses. Ported frommasterking32/MasterHttpRelayVPN@3094288. •parse_relay_json(Rust client): added unwrapper forgoog.script.init("...userHtml...")iframe — if any deployment ever returns an HtmlService-wrapped response (legacy Code.gs, or a redirect that GET-hits doGet), the client now extracts the inner JSON instead of failing withkey must be a string at line 2 column 1. • Rewrote the README: short bilingual landing page (English + Persian RTL) for normal users, with the full advanced reference moved todocs/guide.mdanddocs/guide.fa.md. Splitting "5-minute quick start" from "every option + troubleshooting" makes the docs much more approachable. In guide.fa.md the[x]task list was replaced with a table because GitHub's RTL renderer mangled the checkbox positions inside<div dir="rtl">. • Tests: 6 new regression tests (3 for goog.script.init unwrap + 3 for lan_utils). 179 lib tests + 33 tunnel-node tests all passing.