feat(sub): Clash/Xray/sing-box formats + name/proto/country filters + dedup + userinfo [T1/T2]
build / aarch64_cortex-a53 (push) Successful in 3m3s
build / x86_64 (push) Successful in 3m10s

Subscription bodies can now be Clash/Mihomo YAML, Xray JSON, or sing-box JSON —
all converge to share-link URIs (the cache stays link-based, so fingerprint/
reconcile/generate are unchanged). stdlib-only: the Clash parser is a focused
subset parser for the proxies: list (flow-style + shallow block-style with one
nesting level for ws/grpc/reality opts), not a general YAML engine.

- subformat.go: DetectSubFormat (override -> content-type -> byte sniff) +
  ParseSubBody dispatch + value helpers + streamQuery/synthLink/ssLink.
- subformat_parsers.go: parseClashProxies (indentation-preserving item collector
  + flow/block YAML node parser), parseXrayOutbounds, parseSingboxOutbounds.
- subfilter.go: FilterSpec + subApplyFilters (name include/exclude regex, proto
  whitelist, country via flag-emoji->ISO or token, dedup by fingerprint).
- sub.go: FetchSubscriptionFull passes Content-Type + Format to ParseSubBody;
  SubUpdate filters before reconcile; ImportNodes accepts pasted Clash/JSON;
  SubUserinfoView + SubInfoJSON (days_left/pct_used/expiring/exhausted).
- model/uci: Subscription.{Format,Include,Exclude,FilterProto,FilterCountry,
  Dedup,ExpireAlertDays} + Group.{FilterProto,FilterCountry,Dedup}; generate.go
  resolveGroupMembers applies group-level proto/country filter + optional dedup.
- main.go: `sub info`. LuCI: subscriptions.js format+filter fields; sub_info ubus + acl.
- tests: subformat_test.go (clash flow/block/skip-unknown, xray, singbox, detect,
  exclude/proto/country/dedup filters, flag->ISO).

Verified live on the 512M VM: Clash import (3 nodes, flow+block); Clash
subscription over uhttpd -> 2 nodes, xray -test OK (valid reality key); exclude
(?i)RU dropped the RU node; sub info works. r14.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
omarandClaude Opus 4.8 committed 2026-07-09 16:05:00 +03:00
1 parent b8cb0c4537
commit c8fe02677f
15 files changed
+1121 -28

No files matched your search

+1 -1
View File
@@ -10,7 +10,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=xrayctl
PKG_VERSION:=0.1.0
PKG_RELEASE:=13
PKG_RELEASE:=14
PKG_MAINTAINER:=shater
PKG_LICENSE:=MIT