Turn one computer into a LAN-wide proxy gateway. Configure proxies once on the gateway machine, and every device in your house (phone / Switch / PS5 / Apple TV / smart TV) uses them — no proxy app needed on each device.
Menu-driven CLI · one-line install · built-in Gateway web dashboard. Built on mihomo (Clash.Meta). 中文: README.md
flowchart LR
subgraph LAN["🏠 Home LAN"]
direction TB
S[🎮 Switch / PS5 / Apple TV]
M[📱 iPhone / Android / TV box]
PC[💻 Other computers]
end
GW["🖥️ Gateway computer
mihomo · TUN · rule-based routing"]
SRC["🌐 Proxy source
subscription / local config / single proxy"]
LAN -- "Change gateway, or set proxy" --> GW --> SRC
style LAN fill:#fff5e6,stroke:#ff9900
style GW fill:#e6f3ff,stroke:#0066cc
style SRC fill:#e6ffe6,stroke:#00aa00
# macOS / Linux
curl -fsSL https://raw.githubusercontent.com/Tght1211/lan-proxy-gateway/main/install.sh | bash
# Windows (Administrator PowerShell)
irm https://raw.githubusercontent.com/Tght1211/lan-proxy-gateway/main/install.ps1 | iex
The script walks you through a setup wizard (proxy source → start → optional auto-start). If GitHub is slow from your network, set GITHUB_MIRROR=https://your-mirror/, or if you already have Clash running locally, export HTTP_PROXY=http://127.0.0.1:7897 first.
sudo gateway start # macOS / Linux
gateway start # Windows (Administrator terminal, no sudo)
The console shows the LAN IP and proxy port — that's what your other devices will point at.
| Your device | Method | What to fill in |
|---|---|---|
| 🎮 Switch / PS5 / Apple TV / smart TV | Change gateway (macOS / Linux only) | Gateway + DNS = the gateway computer's LAN IP |
| 📱 iPhone / Android / browser | Set HTTP proxy | HTTP proxy: gateway IP : 17890 |
| 💻 The gateway machine itself | TUN | Enable TUN in the menu; on macOS press L to switch local DNS |
⚠️ Windows Home limitation: no RRAS, ICS is locked to
192.168.137/24, so "change gateway" mode does not work. All devices must use the "set HTTP proxy" path. Switch / PS5 / Apple TV / smart TVs that can only take a gateway (not a proxy) cannot be served from a Windows host — use Linux / macOS or a soft router instead.
Detailed walkthroughs (with screenshots): docs/en/ — phone / switch / ps5 / appletv / tv
| Capability | What it gives you |
|---|---|
| 🌐 LAN transparent gateway | Devices join by changing gateway + DNS (macOS/Linux); devices that can't change gateway use HTTP proxy (all platforms) |
| 🔗 Three proxy sources | Clash/mihomo subscription URL · local .yaml · an already-running Clash port on the same machine (chaining); local single-proxy mode still supports both 17890 sharing and transparent gateway mode |
| 🏠 Chains preset | One-click "airport entry → residential exit" — AI sites see a residential ASN |
| 🌐 Built-in web dashboard | Open http://gatewayIP:19091/ to switch proxy sources, policy groups, nodes, run latency tests, inspect connected devices, and control TUN / proxy service independently |
| 🔐 Proxy service auth | The LAN HTTP/SOCKS5 mixed-port can be enabled/disabled independently and optionally protected with username/password while TUN stays available |
| ⚡ Source supervisor | Auto-fallbacks subscription/file sources to direct when broken; local single-proxy mode only monitors the port to avoid false switches |
| 🎯 Rule system | Built-in LAN-direct, China-direct, Apple, Nintendo, ad-blocking, AI-service rules; custom rules can target Proxy or any named policy group, for example AI domains through a residential exit while YouTube keeps using the normal proxy group |
| 📊 Node latency probe | Switch-node page concurrently measures latency and sorts by speed |
| 🗒️ Readable log view | mihomo's English logs rendered in a folded, deduplicated view |
Detailed scenarios + traffic-path diagrams: docs/scenarios.md (Chinese)
| Item | Clash Verge LAN Access | LAN Proxy Gateway |
|---|---|---|
| Proxy layer | Application-level HTTP proxy | Network-level transparent proxy + TUN |
| Device setup | Fill proxy IP:Port on every device | Change gateway + DNS (only option for devices that don't take a proxy) |
| Switch / PS5 / TV | Mostly no proxy field → unusable | ✅ Works natively |
| App proxy awareness | Often detectable | Closer to a real router |
| Chains | ❌ | ✅ One-click preset |
Device setup
Commands & config
gateway update # latest release (recommended: do NOT pre-sudo)
gateway update latest # same as above
gateway update v3.4.3 # specific tag (or rollback)
Since v3.4.9, don't pre-sudo: the command runs version lookup and asset download under your user identity (preserving
HTTPS_PROXYetc.), then requests sudo only for the stop/replace/restart step.sudo gateway updatestill works, but macOS's default sudoers strips proxy variables, so GitHub becomes unreachable.
First time upgrading from a pre-v3.4.3 install (no gateway update subcommand yet), just re-run the install script — it overwrites in place and preserves your gateway.yaml:
curl -fsSL https://raw.githubusercontent.com/Tght1211/lan-proxy-gateway/main/install.sh | sudo bash
./dev.sh build # writes .tmp/gateway-dev
./dev.sh test # go test ./...
./dev.sh test-core # smaller core package set
./dev.sh run -- --version
./dev.sh start # builds locally, sudo only for the runtime step
The Go build cache defaults to .cache/go-build inside the repo to avoid global-cache permission issues.
MIT © 2025-2026 Tght1211 Built on mihomo + metacubexd.
$ claude mcp add lan-proxy-gateway \
-- python -m otcore.mcp_server <graph>