erldns_query_throttle (erldns v7.0.0-rc1)

View Source

Stateful query throttling. Currently only throttles ANY queries.

We should_throttle ANY queries to discourage use of our authoritative name servers for reflection/amplification attacks.

Configuration

{erldns, [
    {query_throttle, #{
        enabled => boolean(), %% defaults to true
        ttl => non_neg_integer(), %% Seconds, defaults to 30
    }}
]}

Telemetry events

See segmented_cache for telemetry events under this module name.

Also emits the following telemetry events:

  • [erldns, pipeline, throttle] with host in the metadata.

Summary

Functions

Clear the cache

Throttle the given message if necessary.

Types

host()

-type host() :: inet:ip_address() | inet:hostname().

throttle_hit_count()

-type throttle_hit_count() :: non_neg_integer().

throttle_result()

-type throttle_result() :: ok | throttled.

Functions

clear()

-spec clear() -> any().

Clear the cache

throttle/2

-spec throttle(dns:message(), Context :: {term(), Host :: host()}) -> ok | throttled.

Throttle the given message if necessary.