Skip to content

VLESS Reverse Proxy: Add sniffing to outbound's reverse (which is actually an inbound)#5837

Merged
RPRX merged 7 commits intomainfrom
copilot/implement-issue-5662
Mar 23, 2026
Merged

VLESS Reverse Proxy: Add sniffing to outbound's reverse (which is actually an inbound)#5837
RPRX merged 7 commits intomainfrom
copilot/implement-issue-5662

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 22, 2026

Embed SniffingConfig in the Reverse proto message and wire up config parsing and runtime context propagation.

Proto

  • Add xray.app.proxyman.SniffingConfig sniffing = 2 to Reverse message, reusing the existing type

Config parsing (infra/conf/vless.go)

  • VLessReverseConfig struct reuses existing SniffingConfig and its Build() (protocol normalization, domain lowercasing, etc.)
  • Applied to both simplified and vnext outbound config paths
  • Inbound parsing untouched

Runtime (proxy/vless/outbound/outbound.go)

  • Set SniffingRequest on the reverse context when Sniffing.Enabled is true
  • Flows through SubContextFromMuxInboundBridgeWorker.DispatchDefaultDispatcher.Dispatch

Example config

{
  "id": "...",
  "encryption": "none",
  "reverse": {
    "tag": "reverse-in",
    "sniffing": {
      "enabled": true,
      "destOverride": ["http", "tls"],
      "routeOnly": true
    }
  }
}

Copilot AI and others added 6 commits March 22, 2026 20:34
Add sniffing config fields to the Reverse message in account.proto
and set SniffingRequest in the reverse proxy context when creating
the bridge-side reverse handler.

Co-authored-by: RPRX <63339210+RPRX@users.noreply.github.com>
Agent-Logs-Url: https://github.com/XTLS/Xray-core/sessions/741dccb8-6983-4b67-8767-fd27012ea9f9
Use the existing xray.app.proxyman.SniffingConfig as a nested
`sniffing` field in the Reverse message, matching the same structure
used in ReceiverConfig.sniffing_settings.

Co-authored-by: RPRX <63339210+RPRX@users.noreply.github.com>
Agent-Logs-Url: https://github.com/XTLS/Xray-core/sessions/a8e72170-3d2f-4590-b486-b9d61a82388b
Add VLessReverseConfig struct with Build() method that uses the
existing SniffingConfig.Build() for protocol name validation and
normalization. Applied to both inbound client and outbound config
parsing paths.

Co-authored-by: RPRX <63339210+RPRX@users.noreply.github.com>
Agent-Logs-Url: https://github.com/XTLS/Xray-core/sessions/a8e72170-3d2f-4590-b486-b9d61a82388b
… restore validation

Reuse existing SniffingConfig struct and Build() for config parsing.
Don't touch inbound code. Keep outbound tag validation.

Co-authored-by: RPRX <63339210+RPRX@users.noreply.github.com>
Agent-Logs-Url: https://github.com/XTLS/Xray-core/sessions/16e449e3-972b-4855-8d91-e8f0f5f52d15
@RPRX
Copy link
Copy Markdown
Member

RPRX commented Mar 22, 2026

感觉它配置解析还是有点问题,帮忙改一下 @Fangliding

@RPRX
Copy link
Copy Markdown
Member

RPRX commented Mar 22, 2026

Inbound reverse 有 sniffing 的话报个错

@Fangliding
Copy link
Copy Markdown
Member

Fangliding commented Mar 23, 2026

感觉它配置解析还是有点问题,帮忙改一下 @Fangliding

好像就是这样啊 除了AI给下面那个当vnext legacy解析也加可能有点多余了

@RPRX
Copy link
Copy Markdown
Member

RPRX commented Mar 23, 2026

这个经测试能用吗,我懒得测试了

GitHub 现在这 copilot 不会直接发起 PR 了,导致调教过程别人看不到,我还是觉得公开比较好,@Fangliding 能看到吗

https://github.com/XTLS/Xray-core/agents/pull/5837?session_id=16e449e3-972b-4855-8d91-e8f0f5f52d15

实现 #5662 ,尽量复用现有代码,.pb.go 文件的生成遵循 d14767d 的 commit message 中的指引(需要先修改 .proto 文件)

显然我的意思是在 reverse 内塞一个一样的 sniffing 结构体而不是把每个字段单独提出来

你不写配置解析的吗

配置解析就不能复用现有结构体和解析代码吗?另外不该动的代码别动

@Fangliding
Copy link
Copy Markdown
Member

Fangliding commented Mar 23, 2026

看不到(

sniff这谁提谁测吧(

@RPRX
Copy link
Copy Markdown
Member

RPRX commented Mar 23, 2026

稍微改了一下,func (c *VLessReverseConfig) Build() 在 unmarshal json 时会不会被自动调用来着 @Fangliding

@RPRX
Copy link
Copy Markdown
Member

RPRX commented Mar 23, 2026

查了下会被自动调用的是 UnmarshalJSON(),那没事了,希望这个 PR 能 work 吧,先合了

@RPRX
Copy link
Copy Markdown
Member

RPRX commented Mar 23, 2026

outbound.go 里有个 TODO: email 的注释我忘了当时为啥写,因为刚刚检查了下 email 也是包含在 user 里的,说起来倒是没给 inbound name 等其它项赋值,但是以后可以不复用 outbound 本身的 user 信息而用独立的,以避免流量重复统计的问题

虽然这个直接基于 reverse tag 统计是最方便的,但可能有人想相同 tag、不同 user 吧,我甚至忘了当初赋值 user 这项是干嘛

@RPRX RPRX changed the title Add sniffing support for VLESS reverse proxy VLESS Reverse Proxy: Add "sniffing" to outbound's "reverse" (which is actually an inbound) Mar 23, 2026
@RPRX RPRX marked this pull request as ready for review March 23, 2026 09:48
@RPRX RPRX merged commit 755f0a1 into main Mar 23, 2026
78 checks passed
@RPRX RPRX changed the title VLESS Reverse Proxy: Add "sniffing" to outbound's "reverse" (which is actually an inbound) VLESS Reverse Proxy: Add sniffing to outbound's reverse (which is actually an inbound) Mar 27, 2026
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