Compare commits

...

3 Commits

8 changed files with 396 additions and 140 deletions
+192 -35
View File
@@ -16,22 +16,25 @@
| **qBittorrent** | `192.168.1.200` (macvlan) | PT 下载,独立 IP |
| **Windows** | `192.168.1.177` | 内网办公,SSH |
| **Spark** | `192.168.1.166` | Ubuntu 主机,本地 TUN 代理 |
| **iPhone** | WG `10.0.0.3` | WireGuard 客户端,远程访问内网 |
| **Mac** | WG `10.0.0.4` | WireGuard 客户端,远程访问内网 |
---
## Nginx SNI 分流 (`beijing-vps-stream.conf`)
## Nginx SNI 分流 (`北京vps-stream.conf`)
监听 `:443`,按 SNI 将流量分发到不同后端
**端口 443 — 公网入口**,按 SNI 分发流量
| SNI | 后端 | 端口 | 用途 |
|---|---|---|---|
| `www.apple.com` | Xray interconn | :9443 | 反向代理隧道 |
| `www.microsoft.com` | Xray mihomo_in | :9444 | Mihomo 客户端 → 搬瓦工出口 |
| `news.apple.com` | Xray proxy_from_lan | :9445 | 北京直连代理 |
| `www.apple.com` / `www.samsung.com` / `www.amd.com` / `www.asus.com` | Xray interconn | :9443 | 反向代理隧道4 SNI leastPing 轮换) |
| `www.bilibili.com` | Xray proxy_from_lan | :9445 | 北京直连代理(qBittorrent 出站) |
| `drive.salmonstill.cn` | NAS | :38653 | 绿联云直接转发 |
| 默认 | NPM | :8443 | Nginx Proxy Manager |
搬瓦工 VPS(部署 `东京-vps-stream.conf` + `tokyo-vps-config.json`):`www.microsoft.com` → Xray :9443,默认 → NPM
**端口 9447 — 数据中心回落**:Reality 探针/探测流量回落到此,按 SNI 代理到真实网站
搬瓦工 VPS(部署 `代理vps-stream.conf` + `xray-代理服务器-config.json`):`www.cloudflare.com` → Xray :9443,默认 → NPM。
---
@@ -41,11 +44,12 @@
**Reality 入站** — 共享 privateKey `GGT9LfN_...`,由 Nginx SNI 转发:
| Tag | 端口 | SNI | Reality target |
|---|---|---|---|
| `interconn` | :9443 | `www.apple.com` | `www.apple.com:443` |
| `mihomo_in` | :9444 | `www.microsoft.com` | `www.microsoft.com:443` |
| `proxy_from_lan` | :9445 | `news.apple.com` | `www.apple.com:443` |
| Tag | 端口 | serverNames | Reality target | 说明 |
|---|---|---|---|---|
| `interconn` | :9443 | apple/samsung/amd/asus 4 SNI leastPing 轮换 | `127.0.0.1:9447` | 反向隧道,多 SNI 防封 + 数据中心回落 |
| `proxy_from_lan` | :9445 | `www.bilibili.com` | `www.bilibili.com:443` | 北京直连代理(qBittorrent |
> `mihomo_in`(旧 Mihomo 中转)已删除,客户端直接连接搬瓦工。
**dokodemo-door 入站** — 端口转发到旁路由反向隧道,共 11 个:
@@ -71,12 +75,13 @@
| Tag | 端口 | 类型 | 用途 |
|---|---|---|---|
| `proxy_in` | 10809 | mixed | SOCKS5/HTTP 代理 → 搬瓦工出口 |
| `socks-dynamic` | 38658 | SOCKS5 (password) | 动态 LAN 端口访问 |
**出站**`direct`freedom 直连)`to_tokyo`VLESS+Reality → `67.230.189.235:443`
**出站**`direct`freedom 直连)
**路由**:所有 `external_*` + `interconn` + `socks-dynamic``portal`(反向隧道);`mihomo_in` + `proxy_in``to_tokyo``proxy_from_lan``direct`
**路由**:所有 `external_*` + `interconn` + `socks-dynamic``portal`(反向隧道);`interconn` 探测流量(baidu.com)→ `direct``proxy_from_lan``direct`
> `mihomo_in` + `proxy_in` + `to_tokyo` 旧中转链路(北京→搬瓦工),已删除。
### 旁路由 (`xray-旁路由-config.json`)
@@ -100,8 +105,8 @@
| `to_spark_ssh` | `192.168.1.166:22` | Spark SSH 远程 |
| `to_spark_rdp` | `192.168.1.166:3389` | Spark xRDP 桌面远程 |
| `to_spark_38662` | `192.168.1.166:38662` | Spark 自定义服务 |
| `interconn` | VLESS+Reality → `salmonstill.cn:443` (SNI=www.apple.com) | 隧道链接 |
| `to_beijing_direct` | VLESS+Reality → `salmonstill.cn:443` (SNI=news.apple.com) | 北京直连 |
| `interconn-apple/samsung/mozilla` | VLESS+Reality → `salmonstill.cn:443` (SNI 轮换) | 隧道链接(balancer + leastPing + fallback |
| `to_beijing_direct` | VLESS+Reality → `salmonstill.cn:443` (SNI=www.bilibili.com) | 北京直连 |
| `direct` | freedom | 直连 |
**路由规则**bridge 入站按端口匹配):
@@ -127,9 +132,9 @@
> 所有显式端口规则优先于 catch-all,现有端口转发不受影响。
### 搬瓦工 VPS / 洛杉矶 (`tokyo-vps-config.json`)
### 搬瓦工 VPS (`xray-代理服务器-config.json`)
极简:VLESS+Reality 入站 `:9443`SNI=www.microsoft.com),freedom 出站。
极简:VLESS+Reality 入站 `:9443`SNI=www.cloudflare.com, dest=www.cloudflare.com),freedom 出站。
所有客户端(Spark、旁路由、macOS)直连此服务器,不再经北京 VPS 中转。
---
@@ -149,7 +154,9 @@
配合 **fake-ip DNS**`enhanced-mode: fake-ip`),DNS 请求返回 `198.18.x.x` 假 IP,强制流量进入代理路由。
**代理节点**
- `US-Direct` — VLESS+Reality → `67.230.189.235:443`(默认国外出口,客户端直连搬瓦工)
- `US-Direct` — VLESS+Reality → `67.230.189.235:443`(默认国外出口,客户端直连搬瓦工SNI=www.cloudflare.com
> `Xray-Real` 代理节点(经北京 VPS 中转)已移除,Mihomo 全部直连搬瓦工。
**关键策略组**
- 国外 → `[US-Direct, 直连]`
@@ -183,7 +190,7 @@ launchctl load ~/Library/LaunchAgents/com.mihomo.proxy.plist
qBittorrent(192.168.1.200) 互联网
↓ SOCKS5 旁路由:1080 (socks-lan) ↑
↓ Xray routing → to_beijing_direct │
↓ Reality(VLESS, SNI=news.apple.com) │
↓ Reality(VLESS, SNI=www.bilibili.com) │
↓ 北京VPS:443 → Nginx分流 │
↓ proxy_from_lan:9445 → direct(freedom) ─────────────────┘
@@ -209,14 +216,14 @@ Peer → 北京VPS:51413 → external_qbit → portal
#### 1.1 Nginx Stream SNI 分流 `beijing-vps-stream.conf`
新增 `news.apple.com` SNI 映射(用于旁路由 Mihomo 直连代理):
新增 `www.bilibili.com` SNI 映射(用于旁路由 Mihomo 直连代理):
```nginx
stream {
map $ssl_preread_server_name $backend {
www.apple.com xray; # 旁路由反向代理隧道
www.microsoft.com mihomo; # 外部客户端代理 → 东京出口
news.apple.com xray_lan; # 旁路由 Mihomo 北京直连代理
www.bilibili.com xray_lan; # 旁路由 Mihomo 北京直连代理
drive.salmonstill.cn nas; # 绿联云服务
default npm; # Nginx Proxy Manager
}
@@ -260,7 +267,7 @@ stream {
"realitySettings": {
"show": false,
"target": "www.apple.com:443",
"serverNames": ["news.apple.com"],
"serverNames": ["www.bilibili.com"],
"privateKey": "GGT9LfN_2JdQG68cwrULgUK-adfT6wIokLzWjaB0fXs",
"shortIds": ["7c947a71b94f369e"]
}
@@ -268,7 +275,7 @@ stream {
}
```
> Reality 公私钥复用已有的 `interconn` 入站 keypair`serverNames` 用新的 `news.apple.com` 与 Nginx 对应。
> Reality 公私钥复用已有的 `interconn` 入站 keypair`serverNames` 用新的 `www.bilibili.com` 与 Nginx 对应。
> `target` 设为 `www.apple.com:443`Reality 从此地址偷取真实 TLS 证书用于伪装。
##### 新增入站 `external_qbit`BT 入站端口)
@@ -353,7 +360,7 @@ qBittorrent 出站不走 Mihomo 透明代理,而是通过旁路由上 Xray 的
"security": "reality",
"realitySettings": {
"fingerprint": "chrome",
"serverName": "news.apple.com",
"serverName": "www.bilibili.com",
"publicKey": "62y5gDjPrdeuePGl-D2IW4Cw9Kb8_bSBBTmArvL7Nhs",
"shortId": "7c947a71b94f369e"
}
@@ -367,7 +374,7 @@ qBittorrent 出站不走 Mihomo 透明代理,而是通过旁路由上 Xray 的
{ "type": "field", "inboundTag": ["socks-lan"], "outboundTag": "to_beijing_direct" }
```
> 路径:`qBittorrent → SOCKS5 旁路由:1080 → to_beijing_direct → 北京VPS:443(SNI=news.apple.com) → proxy_from_lan:9445 → direct → 互联网`
> 路径:`qBittorrent → SOCKS5 旁路由:1080 → to_beijing_direct → 北京VPS:443(SNI=www.bilibili.com) → proxy_from_lan:9445 → direct → 互联网`
---
@@ -535,10 +542,160 @@ nc -zv salmonstill.cn 51413
| 文件 | 位置 | 作用 |
|---|---|---|
| `beijing-vps-stream.conf` | 北京VPS `/etc/nginx/stream.conf.d/` | Nginx SNI分流(含 news.apple.com → 9445 |
| `beijing-vps-stream.conf` | 北京VPS `/etc/nginx/stream.conf.d/` | Nginx SNI分流(含 www.bilibili.com → 9445 |
| `xray-北京vps-config.json` | 北京VPS `/usr/local/etc/xray/config.json` | Xray 入站+路由(含 proxy_from_lan + external_qbit |
| `xray-旁路由-config.json` | 旁路由 `/etc/xray/config.json` | Xray bridge + to_qbit(51413) + socks-lan(1080) → to_beijing_direct |
## WireGuard 内网穿透(iPhone / Mac 远程访问内网)
复用已有的 WireGuard 隧道,让外部 iPhone / Mac 通过北京 VPS 中继,访问家里整个 `192.168.1.0/24` 内网的**任意端口**(无需逐个配置端口规则)。
### 架构
```
iPhone (WireGuard App, 10.0.0.3)
Mac (WireGuard, 10.0.0.4)
↓ WG 隧道 (UDP 51820)
北京VPS 49.232.242.90 (wg0, 10.0.0.1/24)
↓ 转发 (iptables FORWARD ACCEPT)
旁路由 192.168.1.199 (10.0.0.2, penetration zone)
↓ 转发 + SNAT (→ 192.168.1.199)
整个 192.168.1.0/24 任意端口可达 (如 Spark 192.168.1.166:8081 Expo dev server)
```
### 虚拟网段 IP 分配
| 设备 | WG IP | 说明 |
|---|---|---|
| 北京 VPS | `10.0.0.1/24` | WG 服务端,监听 `:51820` |
| 旁路由 | `10.0.0.2/24` | 子网代理节点,进 LAN |
| iPhone | `10.0.0.3/32` | WireGuard App |
| Mac | `10.0.0.4/32` | WireGuard |
### 北京 VPS 配置 (`/etc/wireguard/wg0.conf`)
```ini
[Interface]
Address = 10.0.0.1/24
ListenPort = 51820
PrivateKey = <北京VPS私钥>
MTU = 1420
PostUp = iptables -t nat -A POSTROUTING -s 10.0.0.0/24 -o eth0 -j MASQUERADE
PostUp = iptables -A FORWARD -i wg0 -j ACCEPT
PostUp = iptables -A FORWARD -o wg0 -j ACCEPT
PostDown = iptables -t nat -D POSTROUTING -s 10.0.0.0/24 -o eth0 -j MASQUERADE
PostDown = iptables -D FORWARD -i wg0 -j ACCEPT
PostDown = iptables -D FORWARD -o wg0 -j ACCEPT
[Peer]
# 旁路由(子网代理,带 192.168.1.0/24
PublicKey = <旁路由公钥>
AllowedIPs = 10.0.0.2/32, 192.168.1.0/24
PersistentKeepalive = 25
[Peer]
# iPhone
PublicKey = <iPhone公钥>
AllowedIPs = 10.0.0.3/32
PersistentKeepalive = 25
[Peer]
# Mac
PublicKey = <Mac公钥>
AllowedIPs = 10.0.0.4/32
PersistentKeepalive = 25
```
> ⚠️ **关键坑:iptables FORWARD policy DROP**。VPS 装过 Docker 后,`iptables` 的 FORWARD 链默认策略会变成 `DROP`,导致客户端流量穿透 VPS 转发时被丢弃(症状:`ping 10.0.0.1` 通、`ping 10.0.0.2` 不通)。必须在 PostUp 加 `-i wg0` / `-o wg0` 两条 ACCEPT。
> 查看规则用 `iptables -L FORWARD -n -v`**必须带 `-v`**,否则不显示 In/Out 接口列,`grep wg0` 会以为规则不存在)。
### 旁路由配置(ImmortalWrt LuCI
#### 1. 新建 `penetration` zone
网络 → 防火墙 → General Settings → 添加:
| 字段 | 值 |
|---|---|
| Name | `penetration` |
| Input | `accept` |
| Output | `accept` |
| Forward | `accept` |
| Covered networks | `WireGuard` |
| Allow forward to destination zones | `lan` |
同时把 WG 接口从 `wan` zone 的 **Covered networks 取消勾选**(一个接口只能属于一个 zone)。
#### 2. 新增通用 SNAT 规则(关键)
网络 → 防火墙 → NAT 规则 → 添加:
| 字段 | 值 |
|---|---|
| Name | `penetration-snat` |
| 地址族限制 | 仅 IPv4 |
| 协议 | Any |
| 出站区域 | `lan` |
| 源地址 | `10.0.0.0/24` |
| 目标地址 | any |
| 操作 | `SNAT` → 重写 IP `192.168.1.199` |
生成规则:`ip saddr 10.0.0.0/24 ... snat ip to 192.168.1.199`
> ⚠️ **关键坑:penetration zone 勾 masq 无效**。ImmortalWrt (fw4) 的 masquerade 按"出接口"触发,隧道流量转发进 LAN 时出接口是 `br-lan`(属于 lan zone),不会进 `srcnat_penetration`。必须显式加 SNAT 规则,否则 166 等设备的回包发给主路由(192.168.1.1)而丢失(症状:`ping 10.0.0.2` 通、`ping 192.168.1.166` 不通)。
#### 3. Minecraft 端口转发联动
因为 WG 接口从 `wan` 移到了 `penetration`Minecraft 那条 `Minecraft-udp` 端口转发的 **Source zone 要从 `wan` 改成 `penetration`**(玩家流量实际也走 WG 隧道进来),否则 Minecraft 会断。
### 客户端配置
#### iPhone(海外区 App Store 官方 WireGuard
```
[Interface]
PrivateKey = <iPhone私钥>
Address = 10.0.0.3/32
DNS = 223.5.5.5
[Peer]
PublicKey = <北京VPS服务端公钥>
Endpoint = 49.232.242.90:51820
AllowedIPs = 10.0.0.0/24, 192.168.1.0/24
PersistentKeepalive = 25
```
#### Mac
同上,`Address = 10.0.0.4/32`PrivateKey 换成 Mac 的。
> AllowedIPs 只含虚拟网段和内网网段 → split tunnel,仅内网流量走隧道,不影响正常上网。
### 验证命令
```bash
# 北京 VPS 上:确认 3 个 peer 都有握手
wg show
# 客户端设备上:三层诊断(定位故障层级)
ping -c 3 10.0.0.1 # ① 隧道到 VPS —— 通说明客户端配置对
ping -c 3 10.0.0.2 # ② 隧道到旁路由 —— 通说明 VPS 转发对
ping -c 3 192.168.1.166 # ③ 进内网 —— 通说明旁路由转发+SNAT 对
# 旁路由上确认 SNAT 规则
nft list ruleset | grep -iE "penetration-snat|10.0.0.0/24"
```
### 排障对照表
| 现象 | 原因 | 修复 |
|---|---|---|
| `ping 10.0.0.1` 通、`ping 10.0.0.2` 不通 | VPS iptables FORWARD policy DROP | wg0.conf PostUp 加 `-i wg0` / `-o wg0` ACCEPT |
| `ping 10.0.0.2` 通、`ping 192.168.1.166` 不通 | 旁路由缺通用 SNAT | 新增 `penetration-snat`SNAT → 192.168.1.199 |
| 旁路由自己 ping 166 通,但客户端不通 | 同上 | 同上 |
| `iptables -L FORWARD -n \| grep wg0` 为空 | 没带 `-v`,接口列不显示 | 用 `iptables -L FORWARD -n -v` |
## Minecraft UDP 转发
### 架构
@@ -805,7 +962,7 @@ sudo tcpdump -i bridge0 udp port 19132 -n
| **北京 VPS**3 个入站共用) | `GGT9LfN_2JdQG68cwrULgUK-adfT6wIokLzWjaB0fXs` | `62y5gDjPrdeuePGl-D2IW4Cw9Kb8_bSBBTmArvL7Nhs` |
| **搬瓦工 VPS**(客户端直连) | `iBlu3eH1VLf1S5Qw87m_1w0TGYUktDwHAzgpQ2aKuGI` | `jr_zQjC4mvlQITuG5Ap5Mxqe5EBbGyyvwbVLDEi8OCA` |
`Beijing-Direct` 节点必须 `skip-cert-verify: true`,因 Reality 返回 target`www.apple.com`)的证书,而 SNI 是 `news.apple.com`TLS SAN 校验失败。
`Beijing-Direct` 节点必须 `skip-cert-verify: true`,因 Reality 返回 target`www.bilibili.com`)的证书,而 SNI 是 `www.bilibili.com`TLS SAN 校验可能失败。
### Reality 故障排查
@@ -840,7 +997,7 @@ Mihomo 客户端 → 67.230.189.235:443 (SNI=www.cloudflare.com)
### 路径 3qBittorrent 代理出站
```
qBittorrent → SOCKS5 旁路由:1080 → Xray to_beijing_direct
→ salmonstill.cn:443 (SNI=news.apple.com) → proxy_from_lan → direct → 互联网
→ salmonstill.cn:443 (SNI=www.bilibili.com) → proxy_from_lan → direct → 互联网
```
### 路径 4BT 入站
@@ -862,15 +1019,15 @@ BT Peer → salmonstill.cn:51413 → portal → 隧道 → bridge → to_qbit
| 文件 | 目标设备 | 部署路径 |
|---|---|---|
| `beijing-vps-stream.conf` | 北京 VPS | `/etc/nginx/stream.conf.d/` |
|---|---|---|---|
| `北京vps-stream.conf` | 北京 VPS | `/etc/nginx/nginx.conf``stream {}` |
| `xray-北京vps-config.json` | 北京 VPS | `/usr/local/etc/xray/config.json` |
| `东京-vps-stream.conf` | 搬瓦工 VPS | `/etc/nginx/stream.conf.d/` |
| `tokyo-vps-config.json` | 搬瓦工 VPS | `/usr/local/etc/xray/config.json` |
| `代理vps-stream.conf` | 搬瓦工 VPS | `/etc/nginx/nginx.conf``stream {}` |
| `xray-代理服务器-config.json` | 搬瓦工 VPS | `/usr/local/etc/xray/config.json` |
| `xray-旁路由-config.json` | 旁路由 | `/etc/xray/config.json` |
| `旁路由的mihomo config.yaml` | 旁路由 | `/opt/mihomo/config.yaml` |
| `非tun模式的主机mihomo config.yaml` | macOS | `~/Library/LaunchAgents/` (launchctl 管理) |
| `tun模式的主机mihomo config.yaml` | Spark (Ubuntu) | `/opt/mihomo/config.yaml` (systemd) |
| `非tun模式的主机mihomo config.yaml` | macOS | `~/Library/Application Support/mihomo/config.yaml` (launchctl 管理) |
| `tun模式的主机mihomo config.yaml` | Spark (Ubuntu) | `/opt/mihomo/config.yaml`
| `subscribe-7891-only.yaml` | 通用 | 精简版模板(单独 7891 端口) |
| `qbittorrent流量转发.md` | — | 方案文档(已合并到 README,可删除) |
| `我的世界udp转发.md` | — | 方案文档(已合并到 README,可删除) |
+8 -8
View File
@@ -7,7 +7,7 @@
qBittorrent(192.168.1.200) 互联网
↓ SOCKS5 旁路由:1080 (socks-lan) ↑
↓ Xray routing → to_beijing_direct │
↓ Reality(VLESS, SNI=news.apple.com) │
↓ Reality(VLESS, SNI=www.bilibili.com) │
↓ 北京VPS:443 → Nginx分流 │
↓ proxy_from_lan:9445 → direct(freedom) ─────────────────┘
@@ -33,14 +33,14 @@ Peer → 北京VPS:51413 → external_qbit → portal
### 1.1 Nginx Stream SNI 分流 `beijing-vps-stream.conf`
新增 `news.apple.com` SNI 映射(用于旁路由 Mihomo 直连代理):
新增 `www.bilibili.com` SNI 映射(用于旁路由 Mihomo 直连代理):
```nginx
stream {
map $ssl_preread_server_name $backend {
www.apple.com xray; # 旁路由反向代理隧道
www.microsoft.com mihomo; # 外部客户端代理 → 东京出口
news.apple.com xray_lan; # 旁路由 Mihomo 北京直连代理
www.bilibili.com xray_lan; # 旁路由 Mihomo 北京直连代理
drive.salmonstill.cn nas; # 绿联云服务
default npm; # Nginx Proxy Manager
}
@@ -84,7 +84,7 @@ stream {
"realitySettings": {
"show": false,
"target": "www.apple.com:443",
"serverNames": ["news.apple.com"],
"serverNames": ["www.bilibili.com"],
"privateKey": "GGT9LfN_2JdQG68cwrULgUK-adfT6wIokLzWjaB0fXs",
"shortIds": ["7c947a71b94f369e"]
}
@@ -92,7 +92,7 @@ stream {
}
```
> Reality 公私钥复用已有的 `interconn` 入站 keypair`serverNames` 用新的 `news.apple.com` 与 Nginx 对应。
> Reality 公私钥复用已有的 `interconn` 入站 keypair`serverNames` 用新的 `www.bilibili.com` 与 Nginx 对应。
> `target` 设为 `www.apple.com:443`Reality 从此地址偷取真实 TLS 证书用于伪装。
#### 新增入站 `external_qbit`BT 入站端口)
@@ -177,7 +177,7 @@ qBittorrent 出站不走 Mihomo 透明代理,而是通过旁路由上 Xray 的
"security": "reality",
"realitySettings": {
"fingerprint": "chrome",
"serverName": "news.apple.com",
"serverName": "www.bilibili.com",
"publicKey": "62y5gDjPrdeuePGl-D2IW4Cw9Kb8_bSBBTmArvL7Nhs",
"shortId": "7c947a71b94f369e"
}
@@ -191,7 +191,7 @@ qBittorrent 出站不走 Mihomo 透明代理,而是通过旁路由上 Xray 的
{ "type": "field", "inboundTag": ["socks-lan"], "outboundTag": "to_beijing_direct" }
```
> 路径:`qBittorrent → SOCKS5 旁路由:1080 → to_beijing_direct → 北京VPS:443(SNI=news.apple.com) → proxy_from_lan:9445 → direct → 互联网`
> 路径:`qBittorrent → SOCKS5 旁路由:1080 → to_beijing_direct → 北京VPS:443(SNI=www.bilibili.com) → proxy_from_lan:9445 → direct → 互联网`
---
@@ -359,6 +359,6 @@ nc -zv salmonstill.cn 51413
| 文件 | 位置 | 作用 |
|---|---|---|
| `beijing-vps-stream.conf` | 北京VPS `/etc/nginx/stream.conf.d/` | Nginx SNI分流(含 news.apple.com → 9445 |
| `beijing-vps-stream.conf` | 北京VPS `/etc/nginx/stream.conf.d/` | Nginx SNI分流(含 www.bilibili.com → 9445 |
| `xray-北京vps-config.json` | 北京VPS `/usr/local/etc/xray/config.json` | Xray 入站+路由(含 proxy_from_lan + external_qbit |
| `xray-旁路由-config.json` | 旁路由 `/etc/xray/config.json` | Xray bridge + to_qbit(51413) + socks-lan(1080) → to_beijing_direct |
+7
View File
@@ -288,6 +288,12 @@ listeners:
udp: true
proxy: 直连
- name: docker-proxy
type: mixed
port: 7893
listen: 172.20.0.1
udp: true
# ========================
# rules
# ========================
@@ -304,6 +310,7 @@ rules:
- DOMAIN-SUFFIX,okxc.com,国外
- DOMAIN-SUFFIX,services.googleapis.cn,国外
- DOMAIN,connectivitycheck.gstatic.com,国外
- DOMAIN,gateway.push.apple.com,国内
- RULE-SET,Ads,Block
- RULE-SET,Private_Domain,国内
- RULE-SET,Private_IP,国内,no-resolve
+33 -83
View File
@@ -77,15 +77,7 @@
"network": "tcp"
}
},
{
"tag": "proxy_in",
"listen": "127.0.0.1",
"port": 10809,
"protocol": "mixed",
"settings": {
"udp": true
}
},
{
"tag": "external_router_web",
"listen": "0.0.0.0",
@@ -160,39 +152,13 @@
"security": "reality",
"realitySettings": {
"show": false,
"target": "www.apple.com:443",
"target": "127.0.0.1:9447",
"xver": 0,
"serverNames": [
"www.apple.com"
],
"privateKey": "GGT9LfN_2JdQG68cwrULgUK-adfT6wIokLzWjaB0fXs",
"shortIds": [
"7c947a71b94f369e"
]
}
}
},
{
"tag": "mihomo_in",
"listen": "127.0.0.1",
"port": 9444,
"protocol": "vless",
"settings": {
"clients": [
{
"id": "113e167a-a2be-4b46-9010-60020108626c",
"flow": "xtls-rprx-vision"
}
],
"decryption": "none"
},
"streamSettings": {
"network": "raw",
"security": "reality",
"realitySettings": {
"show": false,
"target": "www.microsoft.com:443",
"serverNames": [
"www.microsoft.com"
"www.apple.com",
"www.samsung.com",
"www.amd.com",
"www.asus.com"
],
"privateKey": "GGT9LfN_2JdQG68cwrULgUK-adfT6wIokLzWjaB0fXs",
"shortIds": [
@@ -201,6 +167,7 @@
}
}
},
{
"tag": "proxy_from_lan",
"listen": "127.0.0.1",
@@ -220,9 +187,9 @@
"security": "reality",
"realitySettings": {
"show": false,
"target": "www.apple.com:443",
"target": "www.bilibili.com:443",
"serverNames": [
"news.apple.com"
"www.bilibili.com"
],
"privateKey": "GGT9LfN_2JdQG68cwrULgUK-adfT6wIokLzWjaB0fXs",
"shortIds": [
@@ -301,43 +268,23 @@
"port": 38665,
"network": "tcp"
}
},
{
"tag": "external_expo",
"listen": "0.0.0.0",
"port": 38666,
"protocol": "dokodemo-door",
"settings": {
"address": "127.0.0.1",
"port": 38666,
"network": "tcp"
}
}
],
"outbounds": [
{
"tag": "direct",
"protocol": "freedom"
},
{
"tag": "to_tokyo",
"protocol": "vless",
"settings": {
"vnext": [
{
"address": "67.230.189.235",
"port": 443,
"users": [
{
"id": "4d222c16-53bb-4402-814e-c8188cebcea6",
"encryption": "none",
"flow": "xtls-rprx-vision"
}
]
}
]
},
"streamSettings": {
"network": "raw",
"security": "reality",
"realitySettings": {
"show": false,
"fingerprint": "chrome",
"serverName": "www.microsoft.com",
"password": "jr_zQjC4mvlQITuG5Ap5Mxqe5EBbGyyvwbVLDEi8OCA",
"shortId": "a1b2c3d4",
"spiderX": "/"
}
}
}
],
"routing": {
@@ -458,9 +405,19 @@
{
"type": "field",
"inboundTag": [
"proxy_in"
"external_expo"
],
"outboundTag": "to_tokyo"
"outboundTag": "portal"
},
{
"type": "field",
"inboundTag": [
"interconn"
],
"domain": [
"full:www.baidu.com"
],
"outboundTag": "direct"
},
{
"type": "field",
@@ -469,13 +426,6 @@
],
"outboundTag": "portal"
},
{
"type": "field",
"inboundTag": [
"mihomo_in"
],
"outboundTag": "to_tokyo"
},
{
"type": "field",
"inboundTag": [
+124 -3
View File
@@ -2,6 +2,11 @@
"log": {
"loglevel": "info"
},
"observatory": {
"subjectSelector": ["interconn-apple", "interconn-samsung", "interconn-amd", "interconn-asus"],
"probeUrl": "https://www.baidu.com",
"probeInterval": "1m"
},
"reverse": {
"bridges": [
{
@@ -79,6 +84,13 @@
"redirect": "192.168.1.177:8501"
}
},
{
"tag": "to_expo",
"protocol": "freedom",
"settings": {
"redirect": "192.168.1.166:38666"
}
},
{
"tag": "to_3000",
"protocol": "freedom",
@@ -136,7 +148,7 @@
}
},
{
"tag": "interconn",
"tag": "interconn-apple",
"protocol": "vless",
"settings": {
"vnext": [
@@ -166,6 +178,99 @@
}
}
},
{
"tag": "interconn-amd",
"protocol": "vless",
"settings": {
"vnext": [
{
"address": "salmonstill.cn",
"port": 443,
"users": [
{
"id": "113e167a-a2be-4b46-9010-60020108626c",
"encryption": "none",
"flow": "xtls-rprx-vision"
}
]
}
]
},
"streamSettings": {
"network": "raw",
"security": "reality",
"realitySettings": {
"show": false,
"fingerprint": "chrome",
"serverName": "www.amd.com",
"password": "62y5gDjPrdeuePGl-D2IW4Cw9Kb8_bSBBTmArvL7Nhs",
"shortId": "7c947a71b94f369e",
"spiderX": "/search?q=xray"
}
}
},
{
"tag": "interconn-asus",
"protocol": "vless",
"settings": {
"vnext": [
{
"address": "salmonstill.cn",
"port": 443,
"users": [
{
"id": "113e167a-a2be-4b46-9010-60020108626c",
"encryption": "none",
"flow": "xtls-rprx-vision"
}
]
}
]
},
"streamSettings": {
"network": "raw",
"security": "reality",
"realitySettings": {
"show": false,
"fingerprint": "chrome",
"serverName": "www.asus.com",
"password": "62y5gDjPrdeuePGl-D2IW4Cw9Kb8_bSBBTmArvL7Nhs",
"shortId": "7c947a71b94f369e",
"spiderX": "/search?q=xray"
}
}
},
{
"tag": "interconn-samsung",
"protocol": "vless",
"settings": {
"vnext": [
{
"address": "salmonstill.cn",
"port": 443,
"users": [
{
"id": "113e167a-a2be-4b46-9010-60020108626c",
"encryption": "none",
"flow": "xtls-rprx-vision"
}
]
}
]
},
"streamSettings": {
"network": "raw",
"security": "reality",
"realitySettings": {
"show": false,
"fingerprint": "chrome",
"serverName": "www.samsung.com",
"password": "62y5gDjPrdeuePGl-D2IW4Cw9Kb8_bSBBTmArvL7Nhs",
"shortId": "7c947a71b94f369e",
"spiderX": "/search?q=xray"
}
}
},
{
"tag": "to_beijing_direct",
"protocol": "vless",
@@ -190,7 +295,7 @@
"realitySettings": {
"show": false,
"fingerprint": "chrome",
"serverName": "news.apple.com",
"serverName": "www.bilibili.com",
"password": "62y5gDjPrdeuePGl-D2IW4Cw9Kb8_bSBBTmArvL7Nhs",
"shortId": "7c947a71b94f369e",
"spiderX": "/"
@@ -203,6 +308,14 @@
}
],
"routing": {
"balancers": [
{
"tag": "interconn-balancer",
"selector": ["interconn-apple", "interconn-samsung", "interconn-amd", "interconn-asus"],
"fallbackTag": "interconn-samsung",
"strategy": { "type": "leastPing" }
}
],
"rules": [
{
"type": "field",
@@ -219,7 +332,7 @@
"domain": [
"full:reverse-proxy.xray.internal"
],
"outboundTag": "interconn"
"balancerTag": "interconn-balancer"
},
{
"type": "field",
@@ -357,6 +470,14 @@
"port": "38653",
"outboundTag": "to_nas"
},
{
"type": "field",
"inboundTag": [
"bridge"
],
"port": "38666",
"outboundTag": "to_expo"
},
{
"type": "field",
"inboundTag": [
+30 -11
View File
@@ -1,19 +1,29 @@
stream {
resolver 223.5.5.5;
# === 端口 443Nginx SNI 分流 ===
map $ssl_preread_server_name $backend {
www.apple.com xray; # 旁路由反向代理隧道
www.microsoft.com mihomo; # 新增:mihomo出站流量
news.apple.com xray_lan; # 新增:旁路由代理直连流量
drive.salmonstill.cn nas; # 绿联云服务
default npm; # Nginx Proxy Manager
www.apple.com xray;
www.samsung.com xray;
www.amd.com xray;
www.asus.com xray;
www.bilibili.com xray_lan;
drive.salmonstill.cn nas;
default npm;
}
# === 端口 9447Reality 回落数据中心 ===
map $ssl_preread_server_name $fallback {
www.samsung.com www.samsung.com:443;
www.apple.com www.apple.com:443;
www.amd.com www.amd.com:443;
www.asus.com www.asus.com:443;
default 127.0.0.1:1;
}
upstream xray {
server 127.0.0.1:9443;
}
# 新增mihomo upstream
upstream mihomo {
server 127.0.0.1:9444;
}
# 旁路由代理直连
upstream xray_lan {
server 127.0.0.1:9445;
}
@@ -23,10 +33,19 @@ stream {
upstream npm {
server 127.0.0.1:8443;
}
server {
listen 443 reuseport;
listen [::]:443 reuseport;
ssl_preread on;
proxy_pass $backend;
}
}
server {
listen 127.0.0.1:9447;
ssl_preread on;
proxy_pass $fallback;
proxy_download_rate 1m;
proxy_upload_rate 512k;
}
}
+1
View File
@@ -296,6 +296,7 @@ rules:
- DOMAIN-SUFFIX,okxc.com,国外
- DOMAIN-SUFFIX,services.googleapis.cn,国外
- DOMAIN,connectivitycheck.gstatic.com,国外
- DOMAIN,gateway.push.apple.com,国内
- RULE-SET,Ads,Block
- RULE-SET,Private_Domain,国内
- RULE-SET,Private_IP,国内,no-resolve
@@ -293,6 +293,7 @@ rules:
- DOMAIN-SUFFIX,okxc.com,国外
- DOMAIN-SUFFIX,services.googleapis.cn,国外
- DOMAIN,connectivitycheck.gstatic.com,国外
- DOMAIN,gateway.push.apple.com,国内
- RULE-SET,Ads,Block
- RULE-SET,Private_Domain,国内
- RULE-SET,Private_IP,国内,no-resolve