View Source erldns_encoder (erldns v4.2.0)

Safe response encoding, where exceptions will not result in a full system crash.

Summary

Functions

Encode the DNS message into its binary representation.

Encode the DNS message into its binary representation. Use the Opts argument to pass in encoding options.

Functions

encode_message(Response)

-spec encode_message(dns:message()) -> dns:message_bin().

Encode the DNS message into its binary representation.

Note that if the erldns catch_exceptions property is set in the configuration, then this function should never throw an exception.

encode_message(Response, Opts)

-spec encode_message(dns:message(), [dns:encode_message_opt()]) ->
                        {false, dns:message_bin()} |
                        {true, dns:message_bin(), dns:message()} |
                        {false, dns:message_bin(), dns:tsig_mac()} |
                        {true, dns:message_bin(), dns:tsig_mac(), dns:message()}.

Encode the DNS message into its binary representation. Use the Opts argument to pass in encoding options.

Note that if the erldns catch_exceptions property is set in the configuration, then this function should never throw an exception.