Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
256ac41
直连:缩短握手耗时(选路收敛窗与两段式 offer)
keminar Sep 18, 2026
a0e5e19
文件:同名重名按接收方系统命名,并支持内容比对后选择处理
keminar Sep 20, 2026
c21951d
文件:断点续传改为接管 .part,目标名不再接受续传
keminar Sep 20, 2026
fe8c221
唤醒:新增 -wol 网络唤醒(WOL)功能,receive.allow 增加 wol/dir 细粒度权限
keminar Sep 21, 2026
8652de0
转发:server/client forward 与 direct.rules 改用 tag 配对,不再靠端口相等
keminar Sep 21, 2026
bd3ec8f
文档与构建:WOL 教程英文名化补索引,mips 产物名补版本号
keminar Sep 21, 2026
ca3503a
直连:修复中继两段式 offer 第二段被丢,导致等指纹超时
keminar Sep 21, 2026
9a2b1e3
直连:数据流被拒时明确告知原因,避免误判 session 损坏去重建
keminar Sep 21, 2026
cf3dd28
反射器:answered 日志不再打印带 magic 首字节的原始报文
keminar Sep 21, 2026
4033af9
文档:重排 -conflict 的帮助文字,把参数值和交互提示的按键分开写
keminar Sep 21, 2026
18b1fd8
文档:-wol 帮助文字补上 receive.allow[].wol 这道单独开关
keminar Sep 21, 2026
6fc4f10
文档:-h 不再重复整份 sysctl 调优清单,改成指向 -check/-check-fix
keminar Sep 21, 2026
b7aa641
修复:-check 输出补回原 -h 里那份 sysctl 参考清单,不是只留一句提示
keminar Sep 21, 2026
2cc15af
去掉 token 必须16位的限制:内部归一化成AES key
keminar Sep 22, 2026
5746f2f
优化:-check 输出结尾放结论/action,不被静态清单埋在中间
keminar Sep 22, 2026
efbba01
新增:-via direct/VPS 下 -parallel 开真正独立的 QUIC 连接,不再只是同一条连接的多个 stream
keminar Sep 22, 2026
133410e
合并并行传输/进度条/build 菜单等本地调整
keminar Sep 22, 2026
bd85d29
ignore
keminar Sep 23, 2026
c1c73da
优化:-send/-recv 分块并行改成按连接实测速度自适应分片大小
keminar Sep 23, 2026
f69fb15
优化:覆盖/续传解耦,-parallel 传输失败即时清理并提示不可续传,进度显示当前分片大小
keminar Sep 23, 2026
f829826
新增:client.forward 可标 allowRelay:false,禁止经服务端B中转触发
keminar Sep 23, 2026
ebc1ad7
nat: 反射器测试抓住异步 conn,消除跨用例 data race
keminar Sep 23, 2026
66b9686
调整:-send/-recv 进度显示改成两行,缩短分块并行进度的字段
keminar Sep 23, 2026
9c077e5
nat: 反射器日志 buffer 加锁,消除测试自身的 data race
keminar Sep 23, 2026
42501f7
修复:进度条擦行不再固定甩 200 个空格,改按实际渲染过的最大宽度擦
keminar Sep 23, 2026
16da24d
合并:Windows tun 出站端口重定向、分块并行进度格式、多地址监听、README 声明与加密文档
keminar Sep 23, 2026
1ffb36b
新增:自动探测并规避绝对形式首行触发的后端自重定向死循环;调整:-send/-recv 并发上限降到 3、声明文案精简
keminar Sep 24, 2026
8e652b0
优化:反射器探测超时、中继腿长时间未应答时补充排查线索
keminar Sep 25, 2026
3158f6c
安全:relayAllow 改名 relayEmail 并真正落地准入检查
keminar Sep 25, 2026
7ff3f3f
安全:修复 DNS 越界 panic、token 时序泄漏、无上限读取与首包无超时
keminar Sep 25, 2026
f71e7db
测试:firstline 自探测用例改用保留域名 example.com
keminar Sep 26, 2026
5170a88
优化:geosite 解析/合并去掉临时 map,降低规则加载时的内存尖峰
keminar Sep 27, 2026
c62b3c4
新增:systemd sd_notify 支持,平滑重启时把 MAINPID 迁移给新进程
keminar Sep 28, 2026
01166cd
修复:HTTP 方法白名单缺 PATCH 导致请求整个绕过 http 处理逻辑
keminar Sep 29, 2026
4797749
修复:quic cwnd 趋势打点跟着长连接无条件刷屏
keminar Sep 29, 2026
88c5f79
测试:Windows 下跳过 sd_notify unixgram 用例,修复 CI 失败
keminar Oct 15, 2026
5cf2b0f
测试:修复 TestChunkCursorClaimConcurrent 的死锁
keminar Oct 15, 2026
a1788fc
修复:中继会话先登记 pipe 再回 ready,消除分块并行的解密失败竞态
keminar Oct 16, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ tunneld-alpine
tunnel/logs/
dev/null
anyproxy.exe
dist.tar
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,10 @@ Client proxy settings: point your OS / browser proxy at the anyproxy listen port

Full table of contents see [docs/README.md](docs/en/README.md).

## Disclaimer

This program is built for legitimate connectivity needs. **It is not designed for, and is not well-suited to, circumventing network censorship or accessing restricted content**; any consequences arising from such use, or from being mistaken for such use, are the user's own and not the project's or its author's.

## License

[MIT](LICENSE) © [keminar](https://github.com/keminar)
Expand Down
4 changes: 4 additions & 0 deletions README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,10 @@ make all

完整目录见 [docs/README.md](docs/README.md)。

## 声明

本程序设计目标是解决合法场景下的连通性问题。**它不是为规避网络监管、访问受限内容而设计的工具,也不擅长用于此类用途**,对此类用途下或被误判为此类用途而产生的后果由使用者自行承担,与本项目及作者无关。

## License

[MIT](LICENSE) © [keminar](https://github.com/keminar)
Expand Down
153 changes: 126 additions & 27 deletions anyproxy.go

Large diffs are not rendered by default.

95 changes: 75 additions & 20 deletions build.bat
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
@echo off
rem Build the windows anyproxy packages (amd64 + 386) on Windows.
rem Usage: double-click, or run build.bat in cmd/PowerShell.
rem Build anyproxy packages on Windows. Interactive: prompts for which package(s)
rem to build. Non-interactive: pass the same choice as the first argument, e.g.
rem "build.bat 3", to skip the prompt (handy from scripts/CI).
setlocal
set CGO_ENABLED=0
set GOOS=windows
set RC=0
if not exist dist mkdir dist

Expand All @@ -12,27 +12,82 @@ set VER=dev
for /f %%i in ('git rev-list --tags --max-count^=1 2^>nul') do set REV=%%i
if defined REV for /f %%i in ('git describe --tags %REV% 2^>nul') do set VER=%%i

set CHOICE=%~1
if not "%CHOICE%"=="" goto :dispatch

:prompt
echo Which package(s) to build?
echo 1. Windows 64-bit (amd64, with WinDivert)
echo 2. Windows 32-bit (386, with WinDivert)
echo 3. Linux (amd64)
echo 4. All
set /p CHOICE=Select [1-4, default 4]:
if "%CHOICE%"=="" set CHOICE=4

:dispatch
if "%CHOICE%"=="1" (
call :build_windows amd64 x64
goto :done
)
if "%CHOICE%"=="2" (
call :build_windows 386 x86
goto :done
)
if "%CHOICE%"=="3" (
call :build_linux
goto :done
)
if "%CHOICE%"=="4" (
call :build_windows amd64 x64
if errorlevel 1 goto :done
call :build_windows 386 x86
if errorlevel 1 goto :done
call :build_linux
goto :done
)
echo invalid choice: %CHOICE%
set CHOICE=
goto :prompt

rem One self-contained package dir per arch: dist\anyproxy-windows-<arch>-<VER>\
rem The exe ships next to its own WinDivert runtime. WinDivert.dll has a fixed
rem name but different content for 64/32-bit, so separate dirs avoid clobbering.
rem arch to WinDivert runtime dir: amd64 -> x64, 386 -> x86.
for %%p in (amd64:x64 386:x86) do (
for /f "tokens=1,2 delims=:" %%a in ("%%p") do (
set GOARCH=%%a
echo building dist\anyproxy-windows-%%a-%VER%\anyproxy-windows-%%a-%VER%.exe ...
if not exist "dist\anyproxy-windows-%%a-%VER%" mkdir "dist\anyproxy-windows-%%a-%VER%"
rem -trimpath strips the absolute source path embedded in the binary
go build -trimpath -o "dist\anyproxy-windows-%%a-%VER%\anyproxy-windows-%%a-%VER%.exe" .
if errorlevel 1 (
echo build failed for %%a
set RC=1
goto :done
)
rem WinDivert runtime must sit next to the exe (or set tun.windows.windivertDir).
copy /Y "WinDivert-2.2.2-A\%%b\*" "dist\anyproxy-windows-%%a-%VER%\" >nul
echo build ok: dist\anyproxy-windows-%%a-%VER%
)
rem %1 = GOARCH (amd64/386), %2 = WinDivert runtime subdir (x64/x86).
:build_windows
set GOOS=windows
set GOARCH=%~1
set WDDIR=%~2
echo building dist\anyproxy-windows-%GOARCH%-%VER%\anyproxy-windows-%GOARCH%-%VER%.exe ...
if not exist "dist\anyproxy-windows-%GOARCH%-%VER%" mkdir "dist\anyproxy-windows-%GOARCH%-%VER%"
rem -trimpath strips the absolute source path embedded in the binary
go build -trimpath -o "dist\anyproxy-windows-%GOARCH%-%VER%\anyproxy-windows-%GOARCH%-%VER%.exe" .
if errorlevel 1 (
echo build failed for %GOARCH%
set RC=1
exit /b 1
)
rem WinDivert runtime must sit next to the exe (or set tun.windows.windivertDir).
copy /Y "WinDivert-2.2.2-A\%WDDIR%\*" "dist\anyproxy-windows-%GOARCH%-%VER%\" >nul
echo build ok: dist\anyproxy-windows-%GOARCH%-%VER%
exit /b 0

rem Linux/amd64 package, cross-compiled from Windows: CGO_ENABLED=0 already set
rem above, so this needs no gcc/WSL, just a plain "go build" with GOOS switched.
rem No WinDivert copy and no .exe suffix here -- both are Windows-only, unlike
rem scripts/build.sh linux this doesn't embed -ldflags version info, matching
rem the Windows build above which also skips it.
:build_linux
set GOOS=linux
set GOARCH=amd64
echo building dist\anyproxy-amd64-%VER% ...
go build -trimpath -o "dist\anyproxy-amd64-%VER%" .
if errorlevel 1 (
echo build failed for linux/amd64
set RC=1
exit /b 1
)
echo build ok: dist\anyproxy-amd64-%VER%
exit /b 0

:done
rem Pause only when double-clicked (launched from Explorer), so running from an
Expand Down
19 changes: 16 additions & 3 deletions conf/router.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# 监听端口IP, 优先级低于启动传参,不监听设置为off
# 监听端口IP, 优先级低于启动传参,不监听设置为off。可逗号分隔写多个完整地址(各自带端口),
# 同时绑定多个内网网段的具体 IP, 如 192.168.1.5:3000,10.0.0.5:3000
listen:
# 日志目录
log:
Expand Down Expand Up @@ -82,6 +83,14 @@ tun:
# - 203.0.113.10
# excludeProcs: # 这些进程的出向一律不重定向(逃 OpenVPN 等同机隧道死循环)
# - openvpn.exe
# redirectPorts: # 捕获的出站TCP目标端口; 不配默认[80,443]; 一旦配置则完全覆盖
# - 80 # (需要的端口都要写全, 比如还想抓某远程服务的5000端口)
# - 443
# - 5000
# # 重要: 目的地是 loopback(127.0.0.1/::1)的连接永远不会被 WinDivert 捕获,
# # 不受 redirectPorts/bypassPrivate/skipPorts 等任何配置影响(硬编码防环, 见
# # docs/windows-windivert-redirect.md)。想代理"本机 localhost:port"的流量,
# # 这条路走不通, 只能让发起连接的程序直接配置用 anyproxy 做代理。

# 死循环兜底熔断器(不仅仅应用于全局代理,经过anyproxy的死循环都有效)。
# 同机 A(mode=tun)+B(mode=bypass, 仅Linux) 部署时, 正常应由 bypass 从路由层根治环路;
Expand Down Expand Up @@ -301,8 +310,10 @@ websocket:
# # 专用 UDP socket、探到自己的公网端点、让 A/C 都朝它打洞, 之后在两个来源地址间盲
# # 转发不透明 UDP 包。QUIC/TLS 端到端在 A<->C, 本机看不到明文。关键: 本机**不需要**为
# # 每对 A-C 配 forward/rules/receive.allow, 只要这一个开关; 目标 C 由 A 用 via 指定
# relayAllow: # 可选, 收紧 relay: 只允许这些来源 email(发起中继的 A, 经 B 认证)用本机中继。
# relayEmail: # 可选, 收紧 relay: 只允许这些来源 email(发起中继的 A, 经 B 认证)用本机中继。
# - office@example.com # 留空(且 relay=true)=不限制。仅 email 准入名单, 不涉及 uuid(鉴权在 A<->C 的 e2e 层)
# # 精确匹配、大小写敏感。注意与 forward[].allowRelay 不是一回事(那个是布尔开关)
# # 需服务端 B 为同版本(email 由 B 盖章送来): 配了本名单却收到空 email 时本机拒绝中继
# relayPublic: # 可选。只写 IP 时每个 binding 使用随机端口,并把该端口与全部 IP 组合成候选:
# - "192.0.2.10" # 适合按目标选择不同公网源 IP 的多出口 VPS,不占固定端口槽位
# - "198.51.100.10" # IPv6 同样只写裸地址。若写 IP:port,则切换成下面的固定端口模式:
Expand Down Expand Up @@ -339,6 +350,8 @@ websocket:
# # 也能取走 dir 下的任何东西, 只配一个方向要靠上面的 readonly
# - email: someone@example.com # 仅备注/查找用, 不是安全边界
# uuid: 3fa85f64-5717-4562-b3fc-2c963f66afa6 # 真正的凭证, 抄对方的 websocket.client.uuid
# wol: false # true 才允许这个 email 用 -wol 让本机代为广播网络唤醒包, 默认 false
# dir: # 这个 email 上传时的落地目录, 覆盖上面共享的 dir; 留空则跟其他人一样落到 dir
# true 时强制这条配置只用来给 -send/-recv 命令行取凭证(以及生成/持久化上面的 uuid),
# 常驻的 anyproxy 进程不会为它发起连接, 哪怕配了 subscribe/forward/direct/
# receive 中的几项也照样跳过。
Expand All @@ -348,7 +361,7 @@ websocket:
sendRecvOnly: false
# 同时订阅多台 server: 配了 clients 就只用 clients(上面单个 client 块被忽略), 每项是完整独立配置,
# 字段同上面 client 块(connect/host/user/pass/key/email/subscribe/forward/direct(含
# accept/rules/encrypt/portmap/punchFirst/relay/relayAllow/relayPublic/lanAddrs/plainUdp)/
# accept/rules/encrypt/portmap/punchFirst/relay/relayEmail/relayPublic/lanAddrs/plainUdp)/
# receive/sendRecvOnly; uuid 不可配, 自动生成)
# clients:
# - connect:
Expand Down
34 changes: 33 additions & 1 deletion config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,15 @@ var DebugLevel int
// 绕开一条路径上的问题而牺牲其它路径本来正常的快速路径。
var DirectPlainUDP bool

// ListenPort 监听端口
// ListenPort 监听端口。多地址(ListenAddrs)时取第一个地址的端口, 供只关心"一个端口"
// 的场景使用(回环拨号默认地址、pprof/日志文件名等)。
var ListenPort uint16

// ListenAddrs 代理实际监听的全部地址(host:port)。支持在 -l/配置文件 listen 里用逗号
// 分隔写多个地址, 用来同时绑定多个内网网段的具体 IP, 而不必监听 0.0.0.0(*) 那么宽,
// 也不受限于只能绑一个 IP。
var ListenAddrs []string

// TUNBypassDev TUN 模式下出向连接绑定的物理网卡名(Linux SO_BINDTODEVICE 用)。
var TUNBypassDev string

Expand Down Expand Up @@ -154,6 +160,32 @@ func SetListenPort(gListenAddrPort string) {
ListenPort = uint16(intNum)
}

// SetListenAddrs 设置代理实际监听的地址列表。ListenPort 取第一个地址的端口。
func SetListenAddrs(addrs []string) {
ListenAddrs = addrs
if len(addrs) == 0 {
ListenPort = 0
return
}
SetListenPort(addrs[0])
}

// IsListenPort 判断端口是否是本进程某个监听地址的端口。用于死循环检测(代理请求
// 打回自己的监听器); ListenAddrs 可能有多个不同端口, 不能只比较 ListenPort。
func IsListenPort(port uint16) bool {
if port == 0 {
return false
}
for _, addr := range ListenAddrs {
intStr := tools.GetPort(addr)
intNum, err := strconv.Atoi(intStr)
if err == nil && uint16(intNum) == port {
return true
}
}
return false
}

// IfEmptyThen 取值
func IfEmptyThen(str string, str2 string, str3 string) string {
if str == "" {
Expand Down
2 changes: 2 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,10 @@
- [multi-instance-loop.md](multi-instance-loop.md) — 同机多实例(A 开 tun + B 普通)死循环防护:`mode=bypass` 根治(仅Linux)、`loopGuard` 熔断器兜底、macOS/Windows 替代方案。
- [direct-punch-order.md](direct-punch-order.md) — NAT 直连打洞顺序专题:跨"运营商 CGNAT 家宽 ↔ 公网云主机"时居民/CGNAT 侧必须先发第一个包,否则 NAT 映射被毒化、双向全灭;含 `direct.punchFirst` 配置由来与排查清单。
- [direct-relay-design.md](direct-relay-design.md) — VPS 盲转发中继(TURN 式 direct relay)设计:两端都在 CGNAT 后时经公网 VPS 中转,QUIC/TLS 端到端、VPS 只盲转发不透明 UDP;信令/鉴权/数据面/失败语义。
- [direct-handshake-flow.md](direct-handshake-flow.md) — 直连/中继握手全流程与耗时:谁先发、等谁的顺序不变量,VPS 什么时候才开始转发(两腿都"亲耳听到"才转),token 与证书指纹的生成/流向,打洞的三个时间量(总预算/发包窗口/收敛窗),一次真实连接 5.3s 的逐段分解,以及"选路收敛窗"与"两段式 offer"两个已落地的优化;附五张流程图与日志速查表。
- [tun-dns-vpn-coexist.md](tun-dns-vpn-coexist.md) — TUN 与 VPN(OpenVPN/TAP)共存的三类回包故障:① VPN 内网 DNS 的 /32 路由丢失;② Windows(WinDivert) VPN 传输死循环与 `excludeProcs`/`bypassIPs` 逃逸;③ 入站连接回包被 TUN 吸走(外网 SSH 断)——Linux 源策略路由(自动)、macOS `pf reply-to`(`inboundPorts`)。
- [windows-winDivert.md](windows-winDivert.md) — Windows WinDivert 运行依赖:`WinDivert.dll`/`.sys` 放置、管理员权限、路径含空格/中文的驱动加载问题、bypass 模式在 Windows 已移除。
- [windows-wol.md](windows-wol.md) — Windows 网络唤醒(WOL)配置教程:网卡电源管理与魔术包唤醒开关、关闭「快速启动」和 PCIe 节能、BIOS 里开 Wake On LAN 且必须关 ErP,以及有线网卡/不断电/同一局域网等硬性条件;魔法包发送见 [cli.md](cli.md) 的 `-wol` 参数。
- [todo.md](todo.md) — 待办/待确认:PR #22 审查中暂留未处理的项(透明代理嗅探 `Peek(1)` 无超时 + 实现分叉、`HostBlocksUDP` 热路径线性扫描)。
- [windows-windivert-redirect.md](windows-windivert-redirect.md) — Windows WinDivert 重定向原理:数据包捕获→NAT 改写→本地代理→恢复目的地转发的完整链路;NAT 表、dual-stack 监听、环路防护。
- [windows-windivert-escape.md](windows-windivert-escape.md) — Windows WinDivert 逃逸机制(环路防护专题):anyproxy 自身出站如何逃过捕获避免自环;SOCKS 层 Guard 的竞态缺陷(IPv4 能逃逸、IPv6 稳定自环)与 egress 源端口段根治方案。
15 changes: 12 additions & 3 deletions docs/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

| 参数 | 说明 | 配置文件等价项 | 优先级 |
|------|------|----------------|--------|
| `-l ADDRPORT` | 监听地址端口,如 `:3000` 或 `127.0.0.1:3000`;设为 `off`(或 `none`/`-`)**关闭代理监听**,仅跑 websocket/tun 等后台服务(纯内网穿透用) | `listen` | 命令行 > 配置 > `:3000` |
| `-l ADDRPORT` | 监听地址端口,如 `:3000` 或 `127.0.0.1:3000`;可用逗号分隔写多个地址,同时绑定多个内网网段的具体 IP,如 `192.168.1.5:3000,10.0.0.5:3000`(不必监听 `0.0.0.0`,也不受限于只能绑一个 IP);设为 `off`(或 `none`/`-`)**关闭代理监听**,仅跑 websocket/tun 等后台服务(纯内网穿透用) | `listen` | 命令行 > 配置 > `:3000` |
| `-p PROXIES` | 上级代理,如 `tunnel://10.2.2.2:3001` / `socks5://10.2.2.2:3128` / `http://10.1.1.1:80`;支持逗号分隔多代理与末尾 `local`/`deny` 后缀(见 [routing.md](routing.md#proxy-字段)) | `default.proxy` | 命令行 > 配置 |
| `-c FILEPATH` | 配置文件路径,默认 `conf/router.yaml` | — | — |
| `-mode` | 运行模式(互斥):`proxy`(默认)/ `tunnel`(tunneld 服务端) / `tun`(TUN 全局代理) / `bypass`(物理网卡绕行, 仅 Linux) / `tcpcopy`(端口转发) | `mode` | 命令行 > 配置 |
Expand All @@ -18,9 +18,10 @@
| `-v` | 显示编译版本信息 | — | — |
| `-h` | 显示帮助 | — | — |
| `-genkey` | 生成一对 websocket 鉴权密钥并退出(私钥填 `websocket.client.key`,公钥填 `websocket.server.users[].key`) | `websocket.client.key` / `websocket.server.users[].key` | CLI 一次性 |
| `-wol MAC[,MAC2,...]` | 发送网络唤醒(WOL)魔术包后退出,MAC 支持逗号分隔多个、`AA:BB:CC:DD:EE:FF`/`AA-BB-CC-DD-EE-FF` 两种写法均可;复用 `-to`/`-via` 两个 flag(见下两行),不单独开新名字;`-via` 留默认值 `direct`(即不传)时在本机广播,显式传一个订阅端 email 时改为让该订阅端广播;发送成功不代表对方真的醒了 | — | CLI 一次性 |
| `-send PATH` | 把文件/目录发给另一个订阅端并退出(可跟多个路径);接收端需开 `direct.accept`,端到端加密 | — | CLI 一次性 |
| `-to EMAIL[:subdir]` / `DIR` | `-send`:接收方 email(scp 风格 `:subdir` 落到 `receive.dir/subdir`);`-recv`:本机存放目录(默认当前目录) | — | CLI 一次性 |
| `-via direct\|relay\|VPS的email` | `-send`/`-recv`:直连打洞(`direct`,打不通直接失败)、经服务端 B 中继(`relay`,无需打洞),或填一台公网 VPS 的 email(该机需开 `direct.relay`)盲转发中继打洞(双方都在 CGNAT 后无法直连时用,详见 [direct-relay-design.md](direct-relay-design.md));均端到端加密 | `websocket.client.direct.relay`(VPS 侧) | CLI 一次性 |
| `-to EMAIL[:subdir]` / `DIR` | `-send`:接收方 email(scp 风格 `:subdir` 落到 `receive.dir/subdir`);`-recv`:本机存放目录(默认当前目录);`-wol`:广播目标地址 `ADDR[:PORT]`,默认 `255.255.255.255:9`(受限广播,只在本机所在链路内扩散,不经路由器转发;目标在特定网段时可填该网段定向广播地址,如 `192.168.1.255`),这是**实际执行广播那一端**(本机或 `-via` 指定的订阅端)用的地址 | — | CLI 一次性 |
| `-via direct\|relay\|VPS的email` | `-send`/`-recv`:直连打洞(`direct`,打不通直接失败)、经服务端 B 中继(`relay`,无需打洞),或填一台公网 VPS 的 email(该机需开 `direct.relay`)盲转发中继打洞(双方都在 CGNAT 后无法直连时用,详见 [direct-relay-design.md](direct-relay-design.md));均端到端加密。`-wol`:要唤醒的机器本来就没开机,没法自己接这条命令,这里填**同一个局域网里另一台已经开着**的订阅端 email,由它代为广播(不认 `direct`/`relay` 这两个 `-send`/`-recv` 专用关键字,固定走服务端 B 中继,不打洞——魔术包只有 102 字节,用不上打洞开销),需在该订阅端的 `receive.allow` 里放行本机、且那一条要显式加 `wol: true`(默认 `false`,与收发文件是分开的权限,见 [configuration.md](configuration.md)) | `websocket.client.direct.relay`(VPS 侧) | CLI 一次性 |
| `-recv EMAIL:PATH` | 从另一个订阅端取回文件/目录并退出(scp 风格,路径相对对方 `receive.dir`) | — | CLI 一次性 |
| `-parallel N` | `-send`/`-recv`:单个大文件按字节区间切最多 N 块并行传(默认 1,小文件不切) | — | CLI 一次性 |
| `-direct-plain-udp` | 直连(NAT 打洞)连接:跳过 quic-go 批量/ECN 快速 UDP 路径,回落逐包 I/O;高丢包、拥塞窗口卡死时尝试 | `websocket.client.direct.plainUdp` | 命令行 > 配置 |
Expand Down Expand Up @@ -74,6 +75,14 @@

# TUN 全局代理(需管理员/root,网卡名/地址经配置 tun.name / tun.addr 指定)
sudo ./anyproxy -mode tun -p 'socks5://127.0.0.1:10000'

# 唤醒本机局域网内一台开了 WOL 的机器,可一次唤醒多台、指定网段广播地址
./anyproxy -wol AA:BB:CC:DD:EE:FF
./anyproxy -wol AA:BB:CC:DD:EE:FF,11:22:33:44:55:66 -to 192.168.1.255:9

# 唤醒另一个订阅端所在局域网里的机器(该订阅端需在 receive.allow 里放行本机;
# 要唤醒的机器本身没开机,填的是同一局域网里另一台已开机的订阅端)
./anyproxy -wol AA:BB:CC:DD:EE:FF -via home@example.com
```

> 上级代理协议前缀支持 `tunnel://`、`socks5://`、`http://`。**不写 `://` 前缀时默认按 `tunnel://` 处理**(全局 `-p`/`default.proxy` 与 `hosts[].proxy` 一致)。注:`-h` 帮助里"裸地址按 http"的旧描述与当前实现不符,以此为准。详见 [routing.md](routing.md)。
Loading
Loading