Skip to content

Add package_name_regex rule item - #4013

Closed
hdrover wants to merge 3 commits into
SagerNet:testingfrom
hdrover:feature/package-name-regex
Closed

hdrover wants to merge 3 commits into
SagerNet:testingfrom
hdrover:feature/package-name-regex

Conversation

@hdrover

@hdrover hdrover commented Apr 8, 2026

Copy link
Copy Markdown
Contributor

Closes #4009

Adds package_name_regex — regex matching for Android package names, analogous to the existing process_path_regex for process paths.

Supported in all rule types: route rules, DNS rules, and headless rules (rule sets), as requested.

When combined with invert, this allows matching connections where the package name could not be determined:

{"package_name_regex": [".*"], "invert": true, "outbound": "block"}

Changes:

  • New matcher in route/rule/rule_item_package_name_regex.go
  • Rule set binary format bumped to version 5 with backward-compatible downgrade
  • Documentation updated (EN/ZH) for route rules, DNS rules, headless rules, feature matrices, and rule set source format

Note: I did not add "Since sing-box ..." / "Changes in sing-box ..." version markers in the documentation because I don't know which release this will land in. Happy to update if you prefer a specific version.

@hdrover

hdrover commented Apr 10, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for implementing this upstream in 6746fcb. This PR is now superseded, so I’m closing it. I left one separate note about package_name_regex and the process-rule helper checks, since that part seems to differ from my branch.

@hdrover hdrover closed this Apr 10, 2026
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.

Feature request: ability to match connections with unidentified package name in routing rules

2 participants