Skip to main content

Response Matchers

These matchers inspect response addresses, CNAMEs, RCODEs, and whether a response contains the wanted answer type.

resp_ip​

Purpose​

Matches A and AAAA addresses in the response answers.

Example Configuration​

- tag: matched_resp_ip
type: resp_ip
args:
- "100.64.0.0/10"
- "$special_targets"

Configuration Details​

  • Type: array; Required: yes; Default: none
  • Supported items:
    • single IPs
    • CIDRs
    • provider references with IP match capability, such as ip_set or geoip
  • Runtime impact:
    • Returns true when any A or AAAA answer IP matches any rule.

quick setup​

- matches: "resp_ip 10.0.0.0/8"

Typical Uses​

  • Trigger side effects based on returned answer addresses.

cname​

Purpose​

Matches CNAME targets in the response.

Example Configuration​

- tag: cname_target
type: cname
args:
- "full:alias.example.com"
- "domain:example.com"
- "keyword:cdn"
- "regexp:^edge[0-9]+\\.example\\.net$"
- "$core_domains"
- "&/etc/oxidns/cnames.txt"

Configuration Details​

  • Type: array; Required: yes; Default: none
  • Supported items:
    • domain expressions, supporting full:, domain:, keyword:, regexp:, and bare domains without a prefix as domain: rules
    • provider references with domain match capability, such as domain_set or geosite
    • file references
  • Runtime impact:
    • Returns true when any CNAME target in the response matches.

quick setup​

- matches: "cname keyword:cdn"

Typical Uses​

  • Branch on canonical names returned by upstreams.

rcode​

Purpose​

Matches the current response code.

Example Configuration​

This example mixes text and numeric forms. Both formats are equivalent and can be used together.

- tag: failure_rcodes
type: rcode
args:
- "SERVFAIL"
- "3"

Configuration Details​

  • Type: array; Required: yes; Default: none
  • Supports both enum text and decimal numeric codes; text matching is case-insensitive, and both formats can be mixed in the same list.
  • Common mappings and meanings are listed in the DNS Code Reference.
  • Unknown or future rcodes can still be matched with numeric codes.
  • Runtime impact:
    • Returns true when the response rcode matches the configured set.

quick setup​

- matches: "rcode SERVFAIL,3"

Typical Uses​

  • Follow-up handling for upstream failures or negative responses.

has_resp​

Purpose​

Matches whether a response already exists in the context.

Example Configuration​

- tag: has_resp_flag
type: has_resp

Configuration Details​

No standalone configuration fields.

quick setup​

- matches: "has_resp"

Typical Uses​

  • Guard forwarding so it only runs when no earlier plugin has answered.

has_wanted_ans​

Purpose​

Matches whether the response already contains wanted answers.

Example Configuration​

- tag: has_wanted_answer
type: has_wanted_ans

Configuration Details​

No standalone configuration fields.

quick setup​

- matches: "has_wanted_ans"

Typical Uses​

  • Build follow-up logic only when a meaningful answer is already present.