erldns_handler behaviour (erldns v10.5.3)
View SourceThe module that handles the resolution of a single DNS question.
The meat of the resolution occurs in erldns_resolver:resolve/3
Configuration
{erldns, [
{packet_handlers, [
{my_custom_handler_module, [?DNS_TYPE_A, ?DNS_TYPE_AAAA], 3}
]},
]}Record types can be given in their integer codes or binary representations, meaning, the following are equivalent:
{my_custom_handler_module, [?DNS_TYPE_A, ?DNS_TYPE_AAAA], 3}
...
{my_custom_handler_module, [?DNS_TYPE_A, ~"AAAA"], 3}
...
{my_custom_handler_module, [~"A", ~"AAAA"], 3}The minimum supported version is 2.
Version 2's handler signature is
handle(dns:message(), dns:labels(), dns:type(), [dns:rr()]) -> [dns:rr()]Version 3's handler signature is
handle(dns:dname(), dns:type(), [dns:rr()], dns:message()) -> [dns:rr()].
Summary
Callbacks
Filter the given record set, returning replacement records.
Filter out records not related to the given handler
Map handler's record types to NSEC bit types.
Functions
Filter records through registered handlers.
Call all registered handlers.
Get all registered handlers along with the DNS types they handle and associated versions
Register a record handler with the default version of 1
Register a record handler with version
Register a standalone NSEC type mapper for specific record types.
Start the handler registry process
Unregister NSEC type mappers for specific record types.
Types
-opaque state()
Callbacks
Filter the given record set, returning replacement records.
-callback handle(dns:message(), dns:labels(), dns:type(), [dns:rr()]) -> [dns:rr()].
Filter out records not related to the given handler
Map handler's record types to NSEC bit types.
Functions
Filter records through registered handlers.
-spec call_handlers(dns:message(), dns:labels(), dns:type(), [dns:rr()]) -> [dns:rr()].
Call all registered handlers.
-spec get_versioned_handlers() -> [versioned_handler()].
Get all registered handlers along with the DNS types they handle and associated versions
Register a record handler with the default version of 1
Register a record handler with version
Register a standalone NSEC type mapper for specific record types.
This allows pipeline modules to provide NSEC type mapping without implementing the full handler interface (handle/4, filter/1).
Example:
erldns_handler:register_nsec_type_mapper([30003], fun my_module:nsec_rr_type_mapper/2)
-spec start_link() -> gen_server:start_ret().
Start the handler registry process
-spec unregister_nsec_type_mapper([dns:type()], fun((dns:type(), dns:type()) -> [dns:type()])) -> ok.
Unregister NSEC type mappers for specific record types.