URL Parameters¶
Query parameters for GET /sub, kept as compatible as possible with tindy2013/subconverter so old links can be swapped in directly.
target values¶
target selects the output format. Supported values (including common aliases):
| target | Aliases | Output | Content-Type |
|---|---|---|---|
clash |
clash.meta clashr |
Clash.Meta / mihomo YAML | text/yaml |
singbox |
sing-box |
sing-box JSON | application/json |
surge |
Surge .conf (with [Proxy]/[Proxy Group]/[Rule]) |
text/plain |
|
shadowrocket |
shadow-rocket |
Surge-style managed conf (imported via Shadowrocket's "Config" tab; use clash for home screen subscription) | text/plain |
quanx |
quantumultx quantumult-x |
Quantumult X resource config | text/plain |
loon |
Loon .conf |
text/plain |
|
v2ray |
mixed v2rayn ss ssr trojan |
base64 node subscription (ss/vmess/vless/trojan/hysteria2/tuic share links) | text/plain |
ssd |
shadowsocksdroid |
SSD subscription (ssd:// plus base64 JSON, Shadowsocks only) |
text/plain |
The v2ray aliases ss / ssr / trojan / mixed all emit the same base64 mixed node list: those clients accept mixed lists, and filtering by protocol would only lose nodes. surfboard is an alias of surge; Surfboard imports the Surge config as is.
Subscription input formats (url=)¶
The content behind url= is detected by shape, with no extra parameter:
| Input | Meaning |
|---|---|
| base64 link list | The common case: each decoded line is one share link (ss:// ssr:// vmess:// vless:// trojan:// hysteria2:// tuic:// anytls:// wireguard://, etc.) |
| Clash / Clash.Meta YAML | A proxies: document, parsed directly |
| sing-box JSON | A full config or an outbounds array |
Surge .conf or [Proxy] lines |
Name = ss, host, port, ... |
| Quantumult X resource | shadowsocks=host:port, method=..., tag=... (also reads [server_local]-style sections; filter and rewrite sections are ignored) |
ssd:// URI |
base64 JSON, still common on older airports; one URI is enough, it does not need to be HTTP-reachable |
| A single share link | Put vless://... directly in url=; nothing is fetched |
Separate multiple sources with |. A source may start with tag:<group>, (for example tag:primary,https://...); !!GROUP= matches that tag.
Lines that do not parse are skipped and counted in the log and &check=true; they never fail the whole conversion. An SSD URI and a QuanX resource are single pieces of content you can paste into url= as is.
Protocol coverage
Each target prioritizes the common protocols (ss/vmess/vless/trojan/hysteria2/tuic). A protocol or transport a given target cannot express (e.g. QuanX has no hysteria2/tuic, Loon has no XHTTP) is skipped and listed in the log rather than failing the whole config.
Version gating (target=name[/version])¶
target accepts a version suffix. Examples: target=singbox/1.3.xx (xx and other non-numeric trailing segments are ignored, same as 1.3) or target=singbox/1.13.11. Only singbox reads the version today. The version gates protocols. Nodes the declared kernel cannot render are dropped and listed in SkippedNodes / the log with the reason requires sing-box >= 1.x. Without a version no gating applies, and the output follows the current sing-box release (1.14); declare a version for older kernels. A malformed version (for example singbox/abc) is an error. Other targets accept the suffix and ignore it.
sing-box protocol floors (best effort, from the official release notes):
| Protocol | Minimum sing-box version |
|---|---|
ss / socks / vmess / vless / trojan / wireguard |
1.0 |
hysteria |
1.1 |
tuic |
1.2 |
hysteria2 |
1.5 |
anytls |
1.12 |
Known limits
hysteria1 (v1) has no sing-box outbound. The generator skips it as unsupported for every declared version. anytls needs sing-box 1.12 or newer.
Schema switch¶
The declared version also selects the sing-box config schema (from the official deprecation notes):
| Declared version | Schema behavior |
|---|---|
| >= 1.11 | Rule actions: DNS hijack and reject rules become action: hijack-dns / action: reject. The block / dns special outbounds are not emitted (removed in 1.13; older kernels reject them) |
| >= 1.12 | rule_set and the new DNS format: GEOSITE / GEOIP rules become remote .srs rule-set references (the route.rule_set array, plus route.default_domain_resolver). geoip: private becomes ip_is_private: true. DNS servers use the {type, server} form (1.14 removes the legacy form) |
| No version | Output follows the current sing-box release (1.14): rule actions, the new DNS format, route.rule_set and route.default_domain_resolver. Declare a version (for example singbox/1.11) for older kernels |
Note
The direct outbound is never deprecated and is kept for every version. rule_set entries omit download_detour, which 1.14 deprecates.
rule_set mapping details
GEOIP supports two-letter country codes only (SagerNet/sing-geoip publishes country categories only). GEOIP,PRIVATE/LAN maps to the built-in ip_is_private: true item. Other non-country categories (for example GEOIP,TWITTER) are skipped and reported in diagnostics, so the config never references a rule-set that returns 404. GEOSITE categories map one to one to the sing-geosite repository. Renamed upstream categories are mapped automatically (google-cn becomes google@cn). Rules parse as TYPE,VALUE[,FLAG]: the third field is the flag (for example no-resolve). For AND / OR / NOT, the comma-filled remainder is the value. Lines with more than three fields, or an empty value, cannot render safely. They are skipped and reported in diagnostics (for example the old GEOIP,PRIVATE,policy,no-resolve); the parser never truncates them into a wrong rule.
Common parameters (apply to all targets)¶
| Parameter | Description | Status |
|---|---|---|
target |
Output target (see table above), defaults to clash |
|
url |
Subscription link; separate multiple with \| (required). Raw node links (e.g. vless://…, ss://…) are also accepted directly, so a single node can be converted without a subscription |
|
config |
External INI config URL (source of groups and rules); when omitted, the server's default_config_url is used (no groups/rules if that is unset either) |
|
insert |
Whether to merge the server-side insert_url nodes; overrides the config default (see below) |
|
include |
Node-name allowlist regex: keep only nodes whose name matches (alias include_remarks). Overrides the external INI include_remarks; an empty value does not override. The spec is a single regex; put multiple alternatives inside it (for example (?i)(HK\|JP)) |
|
exclude |
Node-name blocklist regex: drop nodes whose name matches (alias exclude_remarks). Overrides the external INI exclude_remarks; an empty value does not override. Example: (?i)(expired)\|(traffic)\|(website) |
|
template |
Render a full config into a remote sing-box JSON template. The value is an http(s) URL; nodes and NotesName groups are injected. Pins target to singbox (extension parameter) |
|
sort |
Sort by node name | |
dedup |
Remove duplicate nodes: nodes with identical connection fields (type/address/port/credentials/transport) keep only the first | |
append_type |
Prefix node names with [type] (e.g. [SS] HK 01) |
|
tailscale |
Prepend Tailscale DIRECT rules (100.64.0.0/10 and fd7a:115c:a1e0::/48 with no-resolve) to the very beginning of the rules list |
|
exclude_protocol |
Exclude nodes by protocol or type (e.g. hy2,tuic; aliases: exclude_protocols, exclude_types, filter_type) |
|
emoji |
Shortcut: true = strip old emoji then add flags by rule; false = strip emoji and add none. Equivalent to add_emoji=<value> plus remove_emoji=true |
|
add_emoji |
Whether to prepend flag emoji to node names by rule (default true) |
|
remove_emoji |
Whether to first remove existing emoji in node names (default true) |
|
filename |
Set the download filename (Content-Disposition) |
|
interval |
Client subscription auto-update interval (hours, default 24, Profile-Update-Interval header) |
|
proxy |
Upstream proxy for this request; connection initiated by server, must be publicly reachable from server (extension parameter) | |
ua |
Override the fetch User-Agent for this request. Applies to every remote fetch (subscription / rules / external config) (extension parameter; the Web UI has a UA preset dropdown that fills this field). A request with ua neither reads nor writes the shared cache: the UA is an unbounded key space, so caching it would let callers evict every real entry. Set user_agent in the server config if you need caching |
|
nocache |
When 1, bypass this request's TTL cache and force a refetch |
|
flushcache |
When 1, clear the entire shared cache before handling this request (there is also a GET /flushcache endpoint) |
|
check |
When true, return a JSON report of the conversion instead of the config (see below) |
Node-processing parameters (apply to some targets)¶
| Parameter | Description | Applicable targets |
|---|---|---|
udp |
Force UDP on for all nodes | clash / surge family / sing-box |
tfo |
TCP Fast Open | clash (not reflected in other targets yet) |
scv |
skip-cert-verify | clash / surge family / sing-box; reflected as insecure in v2ray share links |
fdn |
Filter out nodes Clash.Meta doesn't support (e.g. Shadowsocks with deprecated ciphers) | mainly clash |
Clash only¶
| Parameter | Description | Status |
|---|---|---|
list |
Output the node list only (proxies:), without groups or rules |
|
expand |
true (default) inlines rules into the config; false emits rule-providers referencing remote rules |
|
provider |
proxy-provider mode: emit a proxy-providers skeleton; the client fetches and refreshes nodes (see below) |
|
provider_interval |
Provider update interval in seconds, default 86400; only read with provider=true. Do not confuse it with interval (hours, client subscription interval) |
Provider mode (&provider=true)¶
Same idea as the original subconverter clash.proxy-provider template. The converter stops fetching and inlining nodes. It emits a Clash.Meta skeleton with proxy-providers. mihomo fetches the subscription and refreshes nodes at provider_interval. Groups and rules stay server-side.
- Each http(s)
url=entry becomes onesub-Nprovider. Share-link entries such asss://are still parsed and inlined locally. &ua=sets the providerheader.User-Agent.&include=/&exclude=becomefilter/exclude-filterand keep applying to nodes the client fetches later.&udp=/&scv=becomeoverride.- Groups:
[]literalselectors in the INIcustom_proxy_groupstay asproxies:members. Regex selectors become a group-levelfilterplususe:(native mihomo behavior, so region groups keep working). With no external config, a minimal "Rocket selector / auto-select" pair is generated. - Not applied: emoji, rename, fdn, dedup, and protocol version gating do not touch provider payloads. The client sees the provider's raw nodes.
- Combining this with
template=or an explicit non-clashtarget=returns 400.
Which mode to use¶
| Your situation | Use | Why |
|---|---|---|
You want renamed nodes (emoji, rename, &include/&exclude rewriting names) |
Normal mode | In provider mode the client fetches nodes from the airport; the converter never sees them |
| The airport changes nodes often and the client should follow | Provider mode | mihomo refreshes at provider_interval without going through the converter |
The airport restricts the User-Agent and you need &ua= |
Either | Normal mode changes the fetch User-Agent; provider mode writes header.User-Agent |
You need &fdn / &dedup / &exclude_protocol to take effect |
Normal mode | These do not apply to provider payloads |
| The client is not a mihomo core | Normal mode | proxy-providers is a mihomo extension; other clients cannot read it |
Diagnostics (&check=true)¶
Runs the same conversion and returns a JSON report instead of the config. Use it when a profile imports but something is missing:
{
"target": "clash",
"content_type": "text/yaml; charset=utf-8",
"output_bytes": 18234,
"provider": false,
"nodes": 42,
"skipped_lines": 3,
"unsupported_nodes": [],
"empty_groups": ["🇯🇵 JP"],
"dropped_rules": ["IP-CIDR,10.0.0.0/8,no-resolve,extra,DIRECT"],
"duplicates": 0,
"deprecated": 0,
"filtered_remarks": 0,
"excluded_protocols": 0,
"subscription_userinfo": "upload=0; download=0; total=0; expire=0"
}
| Field | Meaning |
|---|---|
target |
The target actually used, with the version when one is declared (e.g. singbox/1.13) |
nodes |
Nodes in the output. With provider=true this counts only inline share-link nodes |
skipped_lines |
Subscription lines that did not parse. The count only: an unparseable line is usually a share link, and it still contains a password |
unsupported_nodes |
Nodes the target format cannot carry, dropped by name |
empty_groups |
Groups whose selector matched no node (they are filled with DIRECT). Usually a wrong regex or the airport renamed its nodes |
dropped_rules |
Rules that could not be rendered safely, such as lines with more than three fields |
duplicates / deprecated / filtered_remarks / excluded_protocols |
Nodes removed by &dedup / &fdn / &include / &exclude / &exclude_protocol |
subscription_userinfo |
Traffic and expiry from the airport headers (omitted when absent) |
The response carries Cache-Control: no-store. check=true changes only the response body:
fetching, caching, and rate limiting behave as in a normal conversion.
Rule handling for other targets
surge family / quanx / sing-box always expand rules inline (remote rule sets are fetched and converted
line by line into the target syntax); rule types the target format doesn't support (e.g. Surge has no
GEOSITE/IP-SUFFIX) are dropped and logged. Exception: sing-box with a declared version >= 1.12 keeps
GEOIP/GEOSITE as remote rule_set references, so the client downloads those itself. The v2ray base64
subscription contains no rules — the client manages those itself.
insert_url (node insertion)¶
The server can fix a set of "insert nodes" in its config and merge them into the result on every conversion
(subconverter's insert_url). Commonly used to pin your own relay/landing nodes ahead of the provider's nodes.
# config.example.yaml
insert:
urls:
- https://example.com/my-extra-nodes
prepend: true # true = before the subscription nodes, false = after
enabled: true # whether to insert by default
- The
insertURL param overridesenabled:&insert=falseskips insertion this time,&insert=trueforces it. - Inserted nodes also go through filtering / dedup / emoji / renaming.
- A failed insert-source fetch does not break the main conversion (silently skipped).
- Environment variables:
SUBNG_INSERT_URLS(comma-separated),SUBNG_INSERT_PREPEND,SUBNG_INSERT_ENABLED.
Accepted for compatibility but currently no-op¶
| Parameter | Description |
|---|---|
new_name |
subconverter's old/new naming switch; this project uses the new naming by default, no switch needed |
Rename / cache / rate limit
- rename: in the external config, write
rename=<regex>@<replacement>(supports\1/$1backreferences and empty replacement) to batch-rename nodes. Order of operations: remove emoji → rename → add emoji. - Cache: subscriptions and rule lists are cached in memory by URL with a TTL (default 300s), to avoid hitting GitHub for rule lists on every
/suband getting rate-limited. The cache key covers the User-Agent, the upstream proxy, and the URL, so the same URL under a different UA or a different&proxy=never shares an entry (&proxy=is request-supplied; a shared entry would let one caller's egress answer another's request).cache_ttl: -1sdisables it. - Rate limit:
/subis rate-limited per client IP (default 30/min, burst 10); over-limit returns429 + Retry-After;/versionand the Web UI are exempt. Seeconfig.example.yaml. - Subscription-Userinfo: the traffic / expiry headers returned by the provider are passed through to the client.
emoji behavior (aligned with subconverter)
Order of operations: first remove_emoji strips old → then add_emoji applies flags by regex rule. Rules
come from the external config's emoji=<regex>,<emoji> lines; if unconfigured, the built-in default rule set
is used (ported from subconverter, 95 rules, adapted to Go RE2).
Priority: the emoji shortcut > add_emoji/remove_emoji > external config > default (all true).
To keep the original names entirely: add_emoji=false&remove_emoji=false.
Boolean parameter values
true / 1 / yes / on are truthy, false / 0 / no / off are falsy; anything else falls back to the default.
Encoding reminder¶
url and config are full links and must be URL-encoded when passed as parameters. For example:
- Raw:
https://github.com/you/clash-rule/raw/main/config.init - Encoded:
https%3A%2F%2Fgithub.com%2Fyou%2Fclash-rule%2Fraw%2Fmain%2Fconfig.init
Most clients handle this automatically; remember to encode when building the URL by hand.