Skip to content

Commit 2dd8be7

Browse files
committed
initial release: Rust port of MasterHttpRelayVPN apps_script mode
Faithful port of @masterking32's MasterHttpRelayVPN. All credit for the original idea, protocol, and Python implementation goes to him. Implemented: - Local HTTP proxy (CONNECT + plain HTTP) - MITM with on-the-fly per-domain cert generation via rcgen - CA auto-install for macOS / Linux / Windows - Apps Script JSON relay, protocol-compatible with Code.gs - TLS client with SNI spoofing (connect to Google IP, SNI=www.google.com, inner HTTP Host=script.google.com) - Connection pooling (45s TTL, max 20 idle) - Multi-script round-robin for higher quota - Header filtering (strips connection-specific + brotli) - Config-driven, JSON schema matches Python version Deferred (TODOs in code): - HTTP/2 multiplexing - Request batching / coalescing / response cache - Range-based parallel download - SNI-rewrite tunnels for YouTube/googlevideo - Firefox NSS cert install - domain_fronting / google_fronting / custom_domain modes (mostly broken post-Cloudflare 2024, not a priority) 13 unit tests pass, 2.4MB stripped release binary.
0 parents  commit 2dd8be7

13 files changed

Lines changed: 3543 additions & 0 deletions

File tree

.github/workflows/release.yml

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
name: release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
build:
13+
strategy:
14+
matrix:
15+
include:
16+
- target: x86_64-unknown-linux-gnu
17+
os: ubuntu-latest
18+
name: mhrv-rs-linux-amd64
19+
- target: aarch64-unknown-linux-gnu
20+
os: ubuntu-latest
21+
name: mhrv-rs-linux-arm64
22+
- target: x86_64-apple-darwin
23+
os: macos-latest
24+
name: mhrv-rs-macos-amd64
25+
- target: aarch64-apple-darwin
26+
os: macos-latest
27+
name: mhrv-rs-macos-arm64
28+
- target: x86_64-pc-windows-gnu
29+
os: windows-latest
30+
name: mhrv-rs-windows-amd64
31+
32+
runs-on: ${{ matrix.os }}
33+
34+
steps:
35+
- uses: actions/checkout@v4
36+
37+
- uses: dtolnay/rust-toolchain@stable
38+
with:
39+
targets: ${{ matrix.target }}
40+
41+
- name: Install MinGW toolchain
42+
if: matrix.target == 'x86_64-pc-windows-gnu'
43+
id: msys2
44+
uses: msys2/setup-msys2@v2
45+
with:
46+
msystem: MINGW64
47+
update: true
48+
install: mingw-w64-x86_64-gcc
49+
50+
- name: Install cross-compilation tools
51+
if: matrix.target == 'aarch64-unknown-linux-gnu'
52+
run: |
53+
sudo apt-get update
54+
sudo apt-get install -y gcc-aarch64-linux-gnu
55+
echo '[target.aarch64-unknown-linux-gnu]' >> ~/.cargo/config.toml
56+
echo 'linker = "aarch64-linux-gnu-gcc"' >> ~/.cargo/config.toml
57+
58+
- name: Configure GNU linker
59+
if: matrix.target == 'x86_64-pc-windows-gnu'
60+
shell: pwsh
61+
run: |
62+
$gcc = "${{ steps.msys2.outputs.msys2-location }}\mingw64\bin\gcc.exe" -replace '\\','/'
63+
New-Item -ItemType Directory -Force -Path $env:USERPROFILE/.cargo | Out-Null
64+
Add-Content -Path $env:USERPROFILE/.cargo/config.toml -Value '[target.x86_64-pc-windows-gnu]'
65+
Add-Content -Path $env:USERPROFILE/.cargo/config.toml -Value "linker = '$gcc'"
66+
67+
- name: Build
68+
run: cargo build --release --target ${{ matrix.target }}
69+
70+
- name: Package (unix)
71+
if: runner.os != 'Windows'
72+
run: |
73+
mkdir -p dist
74+
cp target/${{ matrix.target }}/release/mhrv-rs dist/${{ matrix.name }}
75+
chmod +x dist/${{ matrix.name }}
76+
77+
- name: Package (windows)
78+
if: runner.os == 'Windows'
79+
shell: pwsh
80+
run: |
81+
New-Item -ItemType Directory -Force -Path dist
82+
Copy-Item target/${{ matrix.target }}/release/mhrv-rs.exe dist/${{ matrix.name }}.exe
83+
84+
- uses: actions/upload-artifact@v4
85+
with:
86+
name: ${{ matrix.name }}
87+
path: dist/${{ matrix.name }}${{ runner.os == 'Windows' && '.exe' || '' }}
88+
89+
release:
90+
needs: build
91+
runs-on: ubuntu-latest
92+
permissions:
93+
contents: write
94+
steps:
95+
- uses: actions/checkout@v4
96+
with:
97+
fetch-depth: 0
98+
99+
- uses: actions/download-artifact@v4
100+
with:
101+
path: dist
102+
merge-multiple: true
103+
104+
- name: Release
105+
uses: softprops/action-gh-release@v2
106+
with:
107+
files: dist/*
108+
generate_release_notes: true

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
/target
2+
/dist
3+
/ca
4+
/config.json

0 commit comments

Comments
 (0)