Skip to main content

AdGuard DNS Filter

info

自 sing-box 1.10.0 起

sing-box supports some rule-set formats from other projects which cannot be fully translated to sing-box, currently only AdGuard DNS Filter.

These formats are not directly supported as source formats, instead you need to convert them to binary rule-set.

Convert

Use sing-box rule-set convert --type adguard [--output <file-name>.srs] <file-name>.txt to convert to binary rule-set.

Performance

AdGuard keeps all rules in memory and matches them sequentially, while sing-box chooses high performance and smaller memory usage. As a trade-off, you cannot know which rule item is matched.

Compatibility

Almost all rules in AdGuardSDNSFilter and rules in rule-sets listed in adguard-filter-list are supported.

Supported formats

AdGuard Filter

Basic rule syntax

SyntaxSupported
@@:material-check:
||:material-check:
|:material-check:
^:material-check:
*:material-check:

Host syntax

SyntaxExampleSupported
Schemehttps://:material-alert: Ignored
Domain Hostexample.org:material-check:
IP Host1.1.1.1, 10.0.0.:material-close:
Regexp/regexp/:material-check:
Portexample.org:80:material-close:
Pathexample.org/path/ad.js:material-close:

Modifier syntax

ModifierSupported
$important:material-check:
$dnsrewrite=0.0.0.0:material-alert: Ignored
Any other modifiers:material-close:

Hosts

Only items with 0.0.0.0 IP addresses will be accepted.

Simple

When all rule lines are valid domains, they are treated as simple line-by-line domain rules which, like hosts, only match the exact same domain.