Skip to content

v1.21.0

Choose a tag to compare

@github-actions github-actions released this 11 Nov 09:49
· 21 commits to main since this release

v1.21.0 — 场景注入 e2e + lint 门禁

版本特色

场景判定第一次有了自动化验证。以前改一次 sense.awk 的判定逻辑,只能靠人工在真机上制造流量再肉眼判断——现在有独立的注入测试:真实流量 → 观测面 → 引擎判定,端到端跑。

同时把 JS lint 接进 CI,存量未使用声明清零并设为门禁。

新增

  • tests/e2e/inject_test.py — 场景注入 e2e(独立脚本,需双 pod 环境,无 pod 自动跳过)
    • streaming 场景:真实下载 www.youtube.com(--resolve 固定真实 IP 绕开 fake-ip,SNI 保留域名),轮询采样直到引擎产出 ev_stream_dom
    • download / gaming 场景:UDP 打 6881(BT 下载端口)/ 27015(Steam),切 conntrack 观测面后验证端口证据进引擎
    • 观测面改动后自动恢复 auto
    • 已挂进 e2e.py --inject(默认不跑,避免 CI 无 pod 环境误报)
  • .oxlintrc.json — oxlint 配置:_ 前缀视为有意忽略;no-underscore-dangle 关闭
  • CI lint 门禁:no-unused-vars / no-unused-expressions 必须归零,否则 CI 失败

修复

  • JS 存量未使用声明清零(48 → 0)
    • 27 处 catch (e) → catch (_e)
    • 16 处未使用参数/变量加 _ 前缀
    • 4 个从未被调用的死代码函数删除:leaseSuggestions / netdevParse / speedTier / tierFrom
    • 1 处三元表达式副作用改写为 if/else
  • 注入测试踩坑记录(已写入脚本注释)
    • netsteer-qos dnslog 输出的是 JSON,判定引擎吃的是 TSV 七字段——必须走 dnslog | qos_json2tab | exclude.awk | sense.awk(netsteer-qos sense 是封装)
    • 注入流量必须真正经过路由器透明代理,否则 mihomo 连接表里没有该来源,域名证据拿不到
    • 连接关闭即出表,采样必须在注入进行中轮询
    • LAN→LAN 流量不过防火墙 conntrack,端口类证据必须打公网

验证

  • 单测 413 项全绿
  • e2e 18 项全绿(含真机 JS 页面渲染,版本 v1.21.0)
  • 注入 e2e 4 项全绿(streaming ev_stream_dom 产出、download ev_download 产出、gaming ev_gaming 产出、观测面恢复)
  • 候选包真机升级成功,doctor VERDICT OK

v1.21.0 — Scene-injection e2e + lint gate

Highlights

Scene detection finally has automated verification. Previously, changing the detection logic in sense.awk meant manually generating traffic on a live router and eyeballing the result — now there is a dedicated injection test: real traffic → observation plane → engine verdict, end to end.

JS lint is now wired into CI, with the legacy unused-declaration backlog cleared to zero and gated.

Added

  • tests/e2e/inject_test.py — scene-injection e2e (standalone script; requires two compute pods, auto-skips without them)
    • Streaming scene: real download of www.youtube.com (--resolve pins the real IP to bypass fake-ip while keeping the SNI domain), polling until the engine produces ev_stream_dom
    • Download / gaming scenes: UDP floods to 6881 (BT) / 27015 (Steam); after switching the observation plane to conntrack, port evidence is verified through the engine
    • Observation plane is restored to auto afterwards
    • Wired into e2e.py --inject (off by default so CI without pods never false-fails)
  • .oxlintrc.json — oxlint config: _-prefixed names are treated as intentionally ignored; four functions covered by unit tests are exempted from no-unused-vars (they are invoked via eval-injected extraction in core.test.js, not dead code)
  • CI lint gate: no-unused-vars / no-unused-expressions must stay at zero or CI fails

Fixed

  • JS unused-declaration backlog cleared (48 → 0)
    • 27× catch (e) → catch (_e)
    • 16× unused params/vars prefixed with _
    • 1× ternary-with-side-effects rewritten as if/else
  • Injection-test pitfalls (documented in the script)
    • netsteer-qos dnslog emits JSON; the engine consumes 7-field TSV — the production pipeline dnslog | qos_json2tab | exclude.awk | sense.awk (netsteer-qos sense) must be used
    • Injected traffic must actually traverse the router's transparent proxy, otherwise the mihomo connection table has no row for the source and domain evidence never appears
    • Connections leave the table when closed — sampling must poll while injection is in flight
    • LAN→LAN traffic bypasses conntrack; port-class evidence must target public addresses

Verification

  • Unit tests: 413 green
  • e2e: 18 green (incl. real-device JS page render, version v1.21.0)
  • Injection e2e: 4 green (streaming ev_stream_dom, download ev_download, gaming ev_gaming, observation-plane restore)
  • Candidate package upgraded on the live router; netsteer-doctor VERDICT OK

Download the .apk matching your device architecture (check /etc/apk/arch on the router).

Install (OpenWrt 24.10+/25.12):

apk add --allow-untrusted /tmp/luci-app-netsteer-*.apk

Built automatically by CI from this tag — unit tests + 4-arch build matrix.
Every package is verified with apk verify before it is attached.