Skip to content

fix: xray converter and HTTP DSL runtime parity#33

Open
wuchulonly wants to merge 21 commits into
chainreactors:masterfrom
wuchulonly:cyberhub/upstream-fixes
Open

fix: xray converter and HTTP DSL runtime parity#33
wuchulonly wants to merge 21 commits into
chainreactors:masterfrom
wuchulonly:cyberhub/upstream-fixes

Conversation

@wuchulonly

@wuchulonly wuchulonly commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

Summary

  • preserve xray redirect defaults and unwrap string(...) payload scalar casts
  • keep matcher DSL fast path and make missing DSL variables default to empty during eval
  • fix favicon probing and RootURL path-prefix dedupe
  • decode legacy response charsets for DSL body/title/response data and expose raw response data
  • keep cookie jar creation compatible with tinygo
  • adjust runtime equivalence test helper for pointer follow_redirects defaults

Tests

  • go test ./convert ./operators ./protocols/http ./protocols/ssl ./common/tlsx

root and others added 9 commits June 13, 2026 16:37
对齐 xray 默认行为(省略 == true),避免 30x 后的产品签名
(GeoServer Wicket /web/?0、Druid console、Spring Boot whitelabel)被静默丢失。
FollowRedirects 改 *bool 以区分"省略"与"false",显式 false 仍保持不跟随。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
仅含 {{...}}/§...§ 运行时标记的表达式才走 resolve+recompile,其余直接复用
已编译结果(common.Evaluate 对无标记表达式原样返回)。避免每条响应对上万
指纹模板重复解析+编译,缓解组内串行求值的 CPU 瓶颈。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- fetchFavicon 改用 r.Context() 而非页面请求 context,避免继承页面请求已耗尽的
  时间预算,导致慢站点的 xray 风格 favicon 规则误判为不命中
- discoverIconURLs 用相对 "favicon.ico" 基于 base 解析
- attrRE / attrValue 支持未加引号的 link 属性(如 rel=icon href=/path)

补充 fetchFavicon 独立 context 与未加引号属性解析的单元测试。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
标准构建走 cookiejar.New;tinygo 下 cookiejar 不可用,newCookieJar 返回 nil,
使 xrayconv 等 tinygo 构建目标可编译通过。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
xray payload values are frequently written as the string(...) cast,
e.g. `entry: string("/")`. flattenPayloads ran each value through
normalizeXrayScalar, which only stripped bare quoted literals and
left the string(...) call intact. Those values are substituted
verbatim into the request path/headers, so the neutron executer
emitted URLs like `http://host:8848string("/")` -> invalid port.

Unwrap `string("<literal>")` to its inner literal (covers the empty
`string("")` and slash/dot paths). Verified against all stored
fingerprints: every leaked form is this single-literal shape.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@wuchulonly wuchulonly changed the title fix: xray redirect 默认跟随 / matcher DSL 快路径 / favicon 探测修复 / tinygo 兼容 fix: xray converter and HTTP DSL runtime parity Jun 14, 2026
root and others added 12 commits June 14, 2026 10:40
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…er middleware

CyberHub already has a production-grade charsetNormalizingRoundTripper
that handles charset detection and conversion at the HTTP transport layer,
covering GBK/GB2312/Big5/Windows-1251 and more via golang.org/x/net/html/charset
auto-detection with legacy Chinese heuristics. Duplicating a minimal subset
inside neutron's readResponseBody adds an unnecessary golang.org/x/text
dependency and creates two competing decode paths.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
TinyGo's primary target is WASM where the browser handles cookies and
redirects via fetch(). Go-level CookieJar is never effectively used:
Set-Cookie headers are stripped by the browser, CheckRedirect loop is
removed in TinyGo, and our wasm-src doesn't even make HTTP requests
from Go (JS fetches, Go only runs the matcher engine).

Standard builds continue using net/http/cookiejar.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The rootURLExpansionSentinel and evaluateRequestData were added to
prevent double path-prefix when RootURL already contains the mount
prefix (e.g. /vpn/vpn/index.html). However PathPrefix has zero
callers in CyberHub, mapping, or any downstream consumer — the
feature was added speculatively. Revert to the direct common.Evaluate
call that master uses. If path-prefix dedup is needed later, it can
be re-introduced with a simpler pre-processing approach.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.

2 participants