sing-box guide
The syntax below is for sing-box 1.14 and later. GUI clients: check the bundled core version first.
Get the rule link
Choose sing-box and a profile in the subscription builder and copy the .json link. It's a source-format rule set, not a full config.
Merge into your config
The example uses the full-profile link; swap in yours. Merge each part into the matching place in your config without overwriting your existing DNS, inbounds, or outbounds.
json
{
"http_clients": [
{
"tag": "awa-download",
"domain_resolver": "awa-bootstrap"
}
],
"dns": {
"servers": [
{
"type": "local",
"tag": "awa-bootstrap"
}
],
"rules": [
{
"rule_set": "awa-ads",
"action": "reject",
"no_drop": true
}
]
},
"route": {
"rule_set": [
{
"type": "remote",
"tag": "awa-ads",
"format": "source",
"url": "https://raw.githubusercontent.com/TG-Twilight/AWAvenue-Ads-Rule/main/Filters/AWAvenue-Ads-Rule-Singbox.json",
"http_client": "awa-download",
"update_interval": "1d"
}
]
}
}- Put this DNS reject rule above broader DNS rules.
awa-bootstrapresolves the download URL with system DNS, so sing-box doesn't depend on itself before it has started.- To block at the connection level too, add
{"rule_set":"awa-ads","action":"reject"}toroute.rules. - If you switch to an
.srslink, changeformattobinary.
Check and verify
- Run
sing-box check -c config.jsonon the merged config. - After starting, check the log for a successful rule set download. If you already have
experimental.cache_file, setenabledso the rule set is cached locally and not re-downloaded on every start. - A DNS query for a domain from the list should return REFUSED; normal domains resolve as usual.
References: DNS rule actions, rule sets, HTTP clients, 1.14 migration.
Undo
Remove this reject rule from dns.rules (and the one you added to route.rules). Before also removing awa-ads from route.rule_set, make sure nothing else references it.