Skip to content

AdGuard DNS Filer

Since 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

Syntax Supported
@@
\|\|
\|
^
*

Host syntax

Syntax Example Supported
Scheme https:// Ignored
Domain Host example.org
IP Host 1.1.1.1, 10.0.0.
Regexp /regexp/
Port example.org:80
Path example.org/path/ad.js

Modifier syntax

Modifier Supported
$important
$dnsrewrite=0.0.0.0 Ignored
Any other modifiers

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.