DNS.Constants (DNS v0.5.0)

View Source

DNS protocol constants and limits.

This module centralizes all DNS protocol constants, limits, and magic numbers to improve maintainability and prevent hardcoded values throughout the codebase.

Summary

Functions

DNS over HTTPS port number.

DNS over TLS port number.

Standard DNS port number.

Maximum compression recursion depth to prevent DoS attacks.

Maximum number of compression pointers to follow.

Maximum DNS message size in octets.

Maximum domain name length in octets (excluding the trailing root label).

Maximum DNS message size with EDNS0.

Maximum EDNS0 option code.

Maximum EDNS0 option data length.

Maximum label length in octets.

Maximum number of labels in a domain name.

Maximum RDLENGTH value to prevent memory exhaustion attacks.

Maximum TTL value.

Maximum length of a single TXT string.

Maximum number of TXT strings in a TXT record.

Maximum DNS message size for UDP transport without EDNS0.

Minimum TTL value.

Validate that compression depth is within security limits.

Validate that a domain name is within length limits.

Validate that a label is within length limits.

Validate that an RDLENGTH value is within security limits.

Validate that a TTL is within acceptable range.

Functions

dns_over_https_port()

@spec dns_over_https_port() :: non_neg_integer()

DNS over HTTPS port number.

dns_over_tls_port()

@spec dns_over_tls_port() :: non_neg_integer()

DNS over TLS port number.

dns_port()

@spec dns_port() :: non_neg_integer()

Standard DNS port number.

max_compression_depth()

@spec max_compression_depth() :: non_neg_integer()

Maximum compression recursion depth to prevent DoS attacks.

max_compression_pointers()

@spec max_compression_pointers() :: non_neg_integer()

Maximum number of compression pointers to follow.

max_dns_message_size()

@spec max_dns_message_size() :: non_neg_integer()

Maximum DNS message size in octets.

max_domain_length()

@spec max_domain_length() :: non_neg_integer()

Maximum domain name length in octets (excluding the trailing root label).

max_edns0_message_size()

@spec max_edns0_message_size() :: non_neg_integer()

Maximum DNS message size with EDNS0.

max_edns0_option_code()

@spec max_edns0_option_code() :: non_neg_integer()

Maximum EDNS0 option code.

max_edns0_option_length()

@spec max_edns0_option_length() :: non_neg_integer()

Maximum EDNS0 option data length.

max_label_length()

@spec max_label_length() :: non_neg_integer()

Maximum label length in octets.

max_labels_per_name()

@spec max_labels_per_name() :: non_neg_integer()

Maximum number of labels in a domain name.

max_rdlength()

@spec max_rdlength() :: non_neg_integer()

Maximum RDLENGTH value to prevent memory exhaustion attacks.

max_ttl()

@spec max_ttl() :: non_neg_integer()

Maximum TTL value.

max_txt_string_length()

@spec max_txt_string_length() :: non_neg_integer()

Maximum length of a single TXT string.

max_txt_strings()

@spec max_txt_strings() :: non_neg_integer()

Maximum number of TXT strings in a TXT record.

max_udp_message_size()

@spec max_udp_message_size() :: non_neg_integer()

Maximum DNS message size for UDP transport without EDNS0.

min_ttl()

@spec min_ttl() :: non_neg_integer()

Minimum TTL value.

valid_compression_depth?(depth)

@spec valid_compression_depth?(non_neg_integer()) :: boolean()

Validate that compression depth is within security limits.

valid_domain_length?(domain)

@spec valid_domain_length?(binary()) :: boolean()

Validate that a domain name is within length limits.

valid_label_length?(label)

@spec valid_label_length?(binary()) :: boolean()

Validate that a label is within length limits.

valid_rdlength?(rdlength)

@spec valid_rdlength?(non_neg_integer()) :: boolean()

Validate that an RDLENGTH value is within security limits.

valid_ttl?(ttl)

@spec valid_ttl?(non_neg_integer()) :: boolean()

Validate that a TTL is within acceptable range.