Skip to content

ours-dns-types ​

crates/dns-types — DNS values and the rule interface shared by the router and the optional resolver.

Why a separate crate ​

The router (ours-mod-router) is built without the DNS module (ours-mod-dns is the dns feature), but it still has to understand DNS rules, actions and messages (hijack, DNS sniffing, resolve). The shared part is moved here so that no module depends on another just for types.

Contents ​

  • message — a re-export of ours-dns-wire.
  • options — the dns section in decoded form: DNSOptions, servers (DNSServerOptions, transport variants), rules (DNSRule, DefaultDNSRule, LogicalDNSRule), actions (DNSRuleAction…), records (DNSRecordOptions, DNSRCode). options/record.rs — the needed part of miekg/dns v1.1.72: a parser of one zone-file record, RR.String(), UnpackRR/PackRR.
  • rules — what DNS rules mean for the DNS router: the router walks them like sing-box 1.14.4 (dns/router.go), while the conditions themselves are matched elsewhere behind the Rules trait; Compiler/Compile, Action, RouteOptions, LookupOptions, Query, Responses.
  • client — query options, client subnet encoding (Subnet), formatting of records and rcode — independently of the DNS client.
  • response — made-up responses (FixedResponse* from dns/client.go): status, addresses.
  • filter — what a module that filters queries (adblock) gives the DNS router: a Filter published as a Hook service and the options at POINT (dns_filter).

Who uses it ​

ours-mod-dns, ours-mod-router, ours-mod-adblock. In dev dependencies — ours-kernel, ours-native-config, ours-mod-rule-process, ui.

Specifics ​

Depends on ours-api, ours-config, ours-route-api, ours-codec, ours-json, ours-clock, ours-dns-wire, ours-tls-options.

Tests ​

Unit tests in src/.

GPL-3.0-or-later