sing-box/docs/configuration/rule-set/source-format.md

48 lines
943 B
Markdown
Raw Normal View History

2024-07-17 09:57:35 +00:00
---
icon: material/new-box
---
2023-12-01 05:24:18 +00:00
# Source Format
2024-07-17 09:57:35 +00:00
!!! quote "Changes in sing-box 1.10.0"
:material-plus: version `2`
2023-12-01 05:24:18 +00:00
!!! question "Since sing-box 1.8.0"
### Structure
```json
{
2024-07-17 09:57:35 +00:00
"version": 2,
2023-12-01 05:24:18 +00:00
"rules": []
}
```
### Compile
Use `sing-box rule-set compile [--output <file-name>.srs] <file-name>.json` to compile source to binary rule-set.
### Fields
#### version
==Required==
2024-07-17 09:57:35 +00:00
Version of rule-set, one of `1` or `2`.
* 1: Initial rule-set version, since sing-box 1.8.0.
* 2: Optimized memory usages of `domain_suffix` rules.
The new rule-set version `2` does not make any changes to the format, only affecting `binary` rule-sets compiled by command `rule-set compile`
Since 1.10.0, the optimization is always applied to `source` rule-sets even if version is set to `1`.
It is recommended to upgrade to `2` after sing-box 1.10.0 becomes a stable version.
2023-12-01 05:24:18 +00:00
#### rules
==Required==
List of [Headless Rule](./headless-rule.md/).