Warda-DNSDocs

Personal rules

Protection → My rules (GET /api/v1/rules, PUT|DELETE /api/v1/rules/{domain}, administrators; warda allow, warda block, warda unrule) always wins over the lists. A rule is a domain, which covers its subdomains, or a regular expression written between two slashes (the convention of AdGuard), tested on the whole name asked (in lower case, without the final dot), without regard to case (/Casino/ matches casino.com):

  • /^ads?[0-9]*\./ blocks ads.example.com, ad1.example.com…;
  • /(^|\.)casino/ blocks every name with a label that starts with casino (casino.com, www.casinoroyal.fr).

The expressions use the syntax of Go (RE2): matching takes a time linear in the length of the name, so no expression can slow the filter down (no look-around, no back-reference). An expression is kept as written (\D is not \d), 256 characters at most, 200 expressions at most; one that matches the empty name, or every name of a set of probes (example.com, a.b.c, xn--80ak6aa92e.com, warda-dns.com, wikipedia.org), is refused, to allow as to block (an allowed /./ would turn the filter off). In the path of the API, the slashes are escaped (/api/v1/rules/%2F%5Eads%3F%5B0-9%5D*%5C.%2F). The order: allowing always wins, then domains before expressions (allowed domains, allowed expressions, blocked domains, blocked expressions), then the lists; the expressions of each side run as one alternation, and the rule that matched (shown in the query log) is looked for only on a match. WARDA_ALLOW and WARDA_BLOCK take expressions too, without a comma (the lists of these variables are comma-separated).