lazydns

Domain Set Plugin

The domain_set plugin provides a flexible domain-matching dataset that other plugins can consume. It loads domain rules from files or inline expressions and exposes them via request metadata for fast lookups.

Purpose

Match types & priority

The plugin supports four match types. Evaluation priority is: Full > Domain > Regexp > Keyword.

When multiple domain rules could match, the priority and domain specificity rules ensure deterministic behavior (more specific domain wins before less specific TLD rules).

Data formats

Rules may be provided in files or inline via the exps argument (sequence or single string). Each non-comment line may be one of:

Lines starting with # are ignored. Leading/trailing whitespace is trimmed.

Configuration

Example configuration:

plugins:
  - tag: cn-domains
    type: domain_set
    config:
      files:
        - examples/etc/my-domain-list.txt
      auto_reload: true
      default_match_type: domain

Or inline expressions:

plugins:
  - tag: sample-set
    type: domain_set
    config:
      exps:
        - full:exact.com
        - domain:example.com
        - regexp:.+\.github\.io$
        - keyword:ads

Usage

When the plugin executes, it stores the compiled DomainRules in request metadata under the key domain_set_<name> where <name> is the plugin tag or effective name. Other plugins implementing Matcher can read this metadata and call into it.

Behavior

Diagnostics & stats

Troubleshooting

Best practices