From Exposed to Invisible: Evolution of My Cross-Border Home Network Architecture (Phase B)
Abstract: In the previous post, I used FRP + VPS to bridge my home networks in China and the US, creating a private “Residential IP Proxy Pool.” However, in the Phase A architecture, the system exposed multiple ports (7000, 8900, 10087), which was not elegant and posed a risk of active probing by the GFW.
Today, I completed the Phase B Architecture Upgrade: using WebSocket + Nginx Reverse Proxy to funnel all management traffic, tunnel traffic, and proxy traffic into a single port: 443. To the outside world, this is just a static tech blog with SSL deployment.
1. The Pain Point: Port Anxiety
In the Phase A architecture, my VPS firewall was like a sieve:
:7000: FRP Server Communication Port (Exposed):7500: FRP Dashboard (Exposed):10087: Mac Node Proxy Entry (Exposed):8900: Traffic Monitoring API (Exposed)
This configuration had two fatal flaws:
- Obvious Fingerprint: The TCP protocol characteristics of FRP are easily identifiable, making it fragile during high-sensitivity periods.
- Security Risks: Any port scanning script could discover non-HTTP services running here, increasing the risk of brute-force attacks.
Goal: Expose only :443 (HTTPS) and :80 (Redirect), binding all other ports to 127.0.0.1 so they are inaccessible from the outside.
2. Core Solution: Protocol Camouflage and Routing
To achieve “All-Site 443,” I adopted Nginx as a Unified Gateway, combined with the WebSocket (WSS) protocol for traffic routing.
Architecture Diagram
graph TD
User["External Visitor / Client"] -->|"HTTPS (443)"| Nginx["Nginx Gateway (VPS)"]
subgraph VPS ["VPS Server"]
direction TB
Nginx
Blog["Static Blog (/www/wwwroot)"]
FRPS["FRP Server (:7000)"]
Proxy["Mac Node Reverse Proxy (:10087)"]
end
Nginx -->|"Default Access"| Blog
Nginx -->|"Header: Upgrade=websocket"| FRPS
Nginx -->|"Path: /vmess-mac"| Proxy
FRPS <==>|"FRP Tunnel"| MacNode["Mac Home Node"]
2.1 First Layer of Camouflage: FRP “Parasitism”
Although FRP officially supports WebSocket mode, newer versions (v0.67.0+) have compatibility issues with custom paths. For maximum stealth, I used a lower-level Header Hijacking scheme.
In the Nginx root / configuration:
- Default: Returns the static blog under
/www/wwwroot(the “camouflage” site you are seeing now). - Special Case: If the request header contains
Upgrade: websocketand does not match other specific paths, it is judged as an FRP client, and traffic is forwarded directly to the local listener at:7000.
1 | location / { |
This means when the FRP client connects to wss://blog.example.com:443, Nginx automatically performs a “bait and switch.” From outside the firewall, this looks exactly like a persistent HTTPS request.
2.2 Second Layer of Camouflage: Proxy Data Stream “Invisibility”
In the previous architecture, clients like Shadowrocket connected directly to the VPS at port :10087, sending raw TCP traffic.
Now, I require the Mac X-UI node to change its inbound protocol to WebSocket and specify a hidden path (e.g., /vmess-mac).
Nginx Routing Rules:
1 | # Identify specific path, forward to Mac Node's reverse proxy port |
Thus, all proxy traffic becomes standard HTTPS requests. The path https://blog.example.com/vmess-mac looks just like a blog API endpoint or a static resource, blending perfectly into normal web traffic.
3. Automated Ops: Refusing Manual Configuration
To support this upgrade, all client configurations must be updated synchronously. Manually changing dozens of configs (Android, iOS, Mac, Windows) is tedious and error-prone. I refactored the Python sidecar script (sync_mac.py).
The current logic is:
- Mac Boot
- Pull VPS Config (Get latest UUID and Port Mapping)
- Force Database Update (Ensure local X-UI settings comply with stealth protocol)
The script automatically connects to the local SQLite database, forces the Inbound protocol to WebSocket, and locks the Path:
1 | # Automation Snippet: Force Protocol Correction |
This ensures that no matter how the panel settings are messed with, a container restart will automatically revert traffic to the correct “Phase B Stealth Mode.” This guarantees my system only permits traffic that complies with the new architecture.
4. Final Form and Reflections
After this overhaul, my VPS state is now:
- Open Ports: Only
80(HTTP Redirect),443(HTTPS),22(SSH). - Web: A beautiful, legitimate static personal homepage.
- Hidden Services:
- Traffic Monitoring API (
/report) - Mac Residential Proxy (
/vmess-mac) - Android Residential Proxy (
/vmess-android) - FRP Control Plane (Routed by Nginx)
- Traffic Monitoring API (
This is essentially a prototype of a DePIN (Decentralized Physical Infrastructure Network). Unlike Honeygain or Grass, this system is entirely under my control—data sovereignty is mine, network quality is mine, and there are no middlemen taking a cut or monitoring traffic.
In an era where data is monopolized by tech giants, owning a set of completely independent, indestructible physical network infrastructure is perhaps the ultimate romance for a geek.
Next Step: I plan to research optimizing connection stability on mobile devices or introducing UDP over WSS technology to improve throughput for video streaming.