Skip to content

Conversation

@KobeArthurScofield
Copy link
Contributor

@KobeArthurScofield KobeArthurScofield commented Sep 14, 2025

#5124 (comment)
#5124 (review)

部分性重构 Outbound 相关

  • 现在配置文件严格只允许一个 outbound 只能有一个服务器端点信息,每个服务器端点信息只能有一组认证信息。如果需要像以前一样在单个 outbound 配置多个端点信息,必须使用 routing 配置中的 balancer(可以配合 observation 使用)(强烈建议在 Release Note 中说明,去年移除了旧配置就有用了旧版路由配置失效的报告
  • 修复 Config: Outbound proxy config no need to be nested #5124 中因未考虑周全在可选认证信息的 outbound 引入单层式配置故障的问题
  • 内部代码只接受一个服务器端点,每个服务器端点只接受一组认证信息。如果使用以前版本生成的 ProtoBuf 配置,运行时会自动仅读取最后一组信息
  • 配合上一条,移除使用 RoundRobin 的 PickServer 机制

配置迁移指引

如果配置文件里面存在一个 outbound 配置中设置了不止一个服务器或者一个服务器配置中配置了不止一个用户配置(一个 UUID/密码 视为一个用户),新版本会在读取配置时报错。此时应修改配置进行迁移。

  1. 将多个服务器端点配置及多个用户配置拆分成多个 outbound 配置,每个 outbound 配置应该只包含一个服务器配置及一个用户配置(对于 HTTP 出站和 SOCKS 出站,如果原来没有用户配置则不需要填写用户配置),并设置不同的 tag
  2. 在 routing 配置中配置一个新的 balancer 均衡器:
{
  "routing": {  // 一般情况下配置里面就有这个节点,直接如下加 balancers 即可,不要重复写 routing,这里是作为填写层级示例
    "balancers": [  // 注意这里,可以同时配置多个 balancer 均衡器
      {
        "tag": "newtag",  // 新均衡器tag,下一步会用到,不一定要叫 newtag
        "selector": [  // 见 https://xtls.github.io/config/routing.html#balancerobject
          "outboundtag-1",
          "outboundtag-2",
          // ...
          // 或者如果分离出来的新的 outboundTag 使用一个前缀,后面使用任意字符作为区分的话,可以直接填入前缀
        ],
        "strategy": {
          "type": "random"  // 原来多个用户的行为为 random,多个服务器配置端点的行为为 roundRobin
          // balancer 还可配置 leastPing 及 leastLoad 均衡,详情见文档
        }
      }
    ]
  }
}
  1. 将路由中对应的规则中的 outboundTag: "<原tag>" 换成 balancerTag: "<新均衡器tag>"

附注
移除 PickServer 后,客户端 VMess 动态端口及用户功能失效,配合该失效同时移除了服务端对动态端口的支持,以及相关的 VMess detour 配置项及入站设置中的 allocation 配置(此后单个 inbound 监听多个端口时永远同时监听所有端口,ramdom 策略仅有 VMess 动态端口功能使用)。 此项更改可选,代码目前仅作注释处理,可回滚保留服务端相关功能或彻底移除这些代码。 已经彻底实装
动态端口功能请使用多个 outbound、balancer 配合 observation 代替。

@Fangliding
Copy link
Member

删了就删了为啥费那么大劲全注释框起来
DynamicWorker源于一个古早的vmess动态端口功能 似乎没人在乎 代码里全break掉了(

@KobeArthurScofield
Copy link
Contributor Author

防止有人闻着味就过来,注释掉也不太费事

只要基本同意那就一个提交都清了没问题

break 掉的事好像有报告而且只有一个早年的,看起来没什么人在意

@KobeArthurScofield
Copy link
Contributor Author

还是清了吧

@RPRX
Copy link
Member

RPRX commented Sep 15, 2025

清掉了 1500 行过时的代码,挺好的,可以合了吗

@KobeArthurScofield
Copy link
Contributor Author

没有其它问题就可以合了

@RPRX
Copy link
Member

RPRX commented Sep 15, 2025

VMess 动态端口这个功能咋说呢,也该寿终正寝了,现在无法直接过墙了,过墙全靠 TLS,总不能端口来回跳

有勇士用 IPv6 非 TLS 过墙的话,也应当是 balancer 多 IP,所以动态端口相关代码确实可以删了

@RPRX
Copy link
Member

RPRX commented Sep 15, 2025

看了下,话说 VMess 协议的 spec 似乎一直停留在非 VMess AEAD,算了,都是过时的协议,已经被 VLESS Encryption 完全取代了

如果说 SS 系列还有个原生 UDP,那 VMess 真就没任何东西了,至于 VLESS 的原生 UDP,想做也不难,出了 TUN 之后再说吧

@RPRX RPRX merged commit fe57507 into XTLS:main Sep 15, 2025
39 checks passed
@KobeArthurScofield
Copy link
Contributor Author

KobeArthurScofield commented Sep 15, 2025

VMess 的 spec 两边的文档都在 VMess MD5,只是 v2fly 的文档多加了几个新说明,VMessAEAD 的在 v2fly 的 issue 里,但是,算了

VMess 动态端口只能说思路上有历史意义,但是功能没跟上时代,全随机数被拉黑的背景下虽然裹上传输层也能用,但是用它就只能将服务端监听前置,也不能配置自定义端口导致不能配合 Nginx/Caddy 分流掩盖主动探测特征,加上配置相对别扭、分主从端口每次新建连接必须和主端口通讯一次,问题有,补救无。 如果服务器没有 AES 硬件加速指令支持,甚至会被客户端拖累性能。再说跑正经业务的一般都是固定那么一个或者几个端口跑,在几十个端口上面每几分钟来回跳的嫌疑就很大了
而且会用的人估计不多,因为文档对相关配置项介绍都非常简短而且命名不佳根本不可能知道这是什么配置项,而且这么久都没人提交细化过这个配置项说明,可想而知,能用上的只能抄配置,自己也是看了代码才知道 detour 是用来配置什么的

所以就那样吧,这功能也该退休了

rosebe added a commit to rosebe/Xray-core that referenced this pull request Sep 18, 2025
Outbound: One endpoint and at most one user only (XTLS#5144)
@KobeArthurScofield KobeArthurScofield deleted the lock-single-outbound-endpoint-full branch September 18, 2025 18:02
@KobeArthurScofield
Copy link
Contributor Author

原说明已添加配置迁移指引 有人因为这个配置炸了直接塞指引就行

Dimas862 pushed a commit to Dimas862/Xray-core that referenced this pull request Oct 15, 2025
Revert "v25.10.15"

This reverts commit b69a376.

Revert "VLESS Reverse Proxy: Transfer real Source & Local (IP & port), enabled by default"

This reverts commit 12f4a01.

Revert "XHTTP client: Change default `maxConcurrency` to 1 for speed testing"

This reverts commit 9cc7907.

Revert "Router: Use built-in-dns only once for all rules (in "IPOnDemand"/"IPIfNonMatch" mode) (XTLS#5210)"

This reverts commit 21a9658.

Revert "README.md: Add PasarGuard to Web Panels (XTLS#5224)"

This reverts commit 7f436f5.

Revert "Update github.com/xtls/reality to 20251014195629"

This reverts commit dcfde8d.

Revert "Bump golang.org/x/net from 0.44.0 to 0.46.0 (XTLS#5215)"

This reverts commit 898db92.

Revert "Bump google.golang.org/grpc from 1.75.1 to 1.76.0 (XTLS#5212)"

This reverts commit 8dd0e38.

Revert "transport/internet/reality/reality.go: Safely get negotiated CurveID in VerifyPeerCertificate()"

This reverts commit 40f0a54.

Revert "Bump github.com/refraction-networking/utls from 1.8.0 to 1.8.1 (XTLS#5229)"

This reverts commit 1762d6c.

Revert "Fix shadowsocks2022 memory leak (XTLS#5166)"

This reverts commit 1952488.

Revert "fix: darwin arm64 always has AESGCMHardwareSupport (XTLS#5176)"

This reverts commit 4a825c0.

Revert "Bump github.com/quic-go/quic-go from 0.54.1 to 0.55.0 (XTLS#5208)"

This reverts commit 514c9e5.

Revert "feat(config): add unix socket HTTP config loader support (XTLS#5200)"

This reverts commit 2f366ae.

Revert "Fix vless reverse panic in vision (XTLS#5189)"

This reverts commit c0c88f3.

Revert "Bump github.com/quic-go/quic-go from 0.54.0 to 0.54.1 (XTLS#5180)"

This reverts commit d0344bc.

Revert "Bump google.golang.org/protobuf from 1.36.9 to 1.36.10 (XTLS#5203)"

This reverts commit a6ebb30.

Revert "Outbound: One endpoint and at most one user only (XTLS#5144)"

This reverts commit fe57507.

Revert "Config: Outbound proxy config no need to be nested (XTLS#5124)"

This reverts commit 83c5370.

Revert "Bump google.golang.org/grpc from 1.75.0 to 1.75.1 (XTLS#5129)"

This reverts commit 1a48453.

Revert "app/dispatcher/default.go: Close link when routedDispatch() failed (XTLS#5131)"

This reverts commit 3167e5c.

Revert "app/dispatcher/default.go: Add comment on run-time rejecting non-existent outbound tag"

This reverts commit 5148c57.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants