Skip to content

Latest commit

 

History

History
72 lines (52 loc) · 3.1 KB

File metadata and controls

72 lines (52 loc) · 3.1 KB

Resolution Component

The resolution component (internal/component/resolve/) consolidates all external data resolution services under a unified tree. Each resolver keeps its own typed API and is constructed explicitly at hub startup.

Structure

Package Purpose Cache
resolve/ Resolvers container struct N/A
resolve/cache/ Generic TTL cache (map + mutex + expiry) Shared by Cymru, PeeringDB, IRR
resolve/dns/ DNS resolver (miekg/dns wire protocol) Own TTL-from-response LRU cache
resolve/cymru/ Team Cymru ASN name resolution via TXT DNS 1h via shared cache
resolve/peeringdb/ PeeringDB HTTP client for prefix counts 1h via shared cache + 1s rate limit
resolve/irr/ IRR whois client for AS-SET expansion 1h via shared cache

Construction

Hub startup creates a single Resolvers struct with one shared DNS instance. Cymru receives a TXT resolver function wired to the DNS resolver. PeeringDB and IRR are created independently with their configured server addresses.

Consumers

Consumer Resolver Entry Point
Web UI ASN decoration Cymru decorator_asn.go via NewASNNameDecoratorFromCymru
Looking glass graph Cymru LGConfig.DecorateASN callback
Prefix update command PeeringDB prefix_update.go imports resolve/peeringdb

Dependencies

cymru --> resolve/dns (sibling import, TXT queries)
peeringdb --> resolve/irr (AS-SET name validation)

These are genuine data dependencies, not architectural coupling.

CLI

The ze resolve offline command exposes all resolvers as standalone tools. Each subcommand creates a fresh resolver instance, queries, prints, and exits. No running daemon required.

Command Flags Output
ze resolve dns [--server <host>] <a|aaaa|txt|ptr> <name> --server One record per line
ze resolve cymru [--dns-server <host>] asn-name <asn> --dns-server Org name
ze resolve peeringdb [--url <url>] max-prefix <asn> --url ipv4: N / ipv6: N
ze resolve peeringdb [--url <url>] as-set <asn> --url One AS-SET per line
ze resolve irr [--server <host>] as-set <name> --server One AS<N> per line
ze resolve irr [--server <host>] prefix <name> --server One prefix per line

DNS Config

DNS resolver configuration comes from YANG (ze-dns-conf.yang): environment/dns with leaves: server, timeout, cache-size, cache-ttl.