Repository navigation
Conversation
…groups and balancers A "pasarguard" directive in a client template selects the user's hosts by inbound tag, inbound tag regex, remark regex or host id: - Xray JSON: per_host mode appends the selected other hosts as extra outbounds (<prefix>-1..n or remark tags); single mode returns one config with only the injected outbounds, so a balancer can span all servers. - Sing-box: a selector/urltest with the directive gets only the proxies it selects, after the entries written in the template. - Clash/Mihomo: a proxy group with the directive gets the selected proxy names appended without duplicates. The key is always stripped. Templates without it render byte for byte as before. Invalid directives are rejected when an Xray, Sing-box or Clash template is saved.
SubRule gets an optional template_id. When a rule matches and has one, that template replaces the default for the rule's format (xray, sing_box, clash, clash_meta); a host-level Xray template still wins. Resolution lives in resolve_client_templates (host > rule > default) and the config cache key includes the template, so two clients of one user do not share output. Saving settings checks that the template exists and fits the rule target; deleting a template a rule uses is refused with 409. Single-mode Xray configs are named after the subscription profile title.
… server groups Subscription rules for xray, sing_box, clash and clash_meta get a Template select in the rule's advanced sheet (default = null) and a badge with the template name on the row; changing the target to another template type resets it. template_id is now kept when settings are loaded and saved. Client templates that use the pasarguard directive get a Server groups badge, and the editor for subscription templates has a help panel with examples and an Insert example button.
…never emit empty groups
Contributor
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
…wn direct outbound When the selector of a single mode template matched none of the user's servers, the config held only the template's outbounds and Xray sent all traffic to the first one (often direct). Fall back to all of the user's servers, as empty sing-box and Clash groups already do. Also: skip a repeated single template before parsing it, check reserved tag prefixes once as a tuple instead of growing the set with every proxy-N (same output, less work for per_host), and drop the unused single_remarks constructor argument.
…templates that have one A remark or SNI containing "pasarguard" no longer triggers a YAML parse of the whole output. Selector regexes are limited to 256 characters, and tags is rejected for any value except null.
…cannot be deleted The rule patterns are subscription settings that an admin with client_templates.delete may not be allowed to read. Template validation uses the same libyaml loader.
…e one Xray template cache A set profile title that formats to an empty string stays empty as before; only an unset one becomes "Subscription". subscription_xray_templates now reads the per-type cache instead of keeping a second copy.
…precedence and sing-box/Clash rule templates
…ples on lines of their own Insert example no longer glues the Clash YAML example to the line at the cursor, and adds the Xray block in single mode; a per_host template with an empty selector shows a size warning. The rule sheet skips the template list without client_templates.read_simple, the template badge is a real button, the directive badge ignores comments and string values, and the sheet text no longer promises a template picker for formats without one.
Rerowros
marked this pull request as draft
October 25, 2026 21:00
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Lets client templates decide where the user's servers go: into balancers, url-test / fallback groups, or a single config. It also lets a subscription rule pick the template. This brings template routing to the level of Remnawave's host injection directives and covers #517.
pasarguardkey in client templates; it is stripped before the config is sent. The selector{inbound_tags, inbound_tag_regex, remark_regex, host_ids}works the same in all formats: conditions are ANDed, and{}means all of the user's servers. Atagskey is reserved for host tags (feat(hosts): reusable color-coded host tags #667)."pasarguard": {"mode": "per_host" | "single", "inject": [{"select": {...}, "tag_prefix": "proxy", "tag_from": "index" | "remark"}]}.singlereturns one config in which every selected server becomesproxy-1..N, ready for aleastPingbalancer.dialer-<tag>, so a["proxy-"]selector never picks a direct dialer."pasarguard": {"include_proxies": true, "select": {...}}fills a group with only the selected servers.template_id, so one client app can get its own template without changing the default./sub/{token}/{format}) keep using the default template.Templates without the directive produce the same output as before.
Part of splitting #759 into focused PRs.
Type of change
Checklist
Testing
End to end on a local panel: for a user matched by the rule, an Xray template in
singlemode returned one config with a balancer overproxy-1..3. Another user got the usual per-host configs.Screenshots
Will add in a comment.
Notes for reviewers
template_idlives inside the subscription settings JSON.