DnsServerOptions Class

Configures the DNS server listeners.

public sealed class DnsServerOptions

Constructors

NameDescription
DnsServerOptions()

DnsServerOptions()

DnsServerOptions.cs
public DnsServerOptions()

No documentation is available.

Properties

NameDescription
MaxConcurrentQueriesPerConnectionGets or sets how many queries a single connection may have in flight at once. Defaults to 16.
MaxUdpResponseSizeGets or sets the largest UDP response the server will send, in bytes. A client's advertised EDNS payload size is clamped to this value; larger answers are truncated so the client retries over TCP. Defaults to 1232 bytes, the size recommended by DNS Flag Day 2020, which also limits how much a spoofed query can amplify.
QuicIdleTimeoutGets or sets how long a DNS over QUIC connection may stay idle before it is closed. Defaults to 30 seconds.
TcpIdleTimeoutGets or sets how long a TCP or DNS over TLS connection may sit without a complete query before the server closes it (RFC 7766 6.2.3). Defaults to 30 seconds. Use Timeout.InfiniteTimeSpan to disable, at the cost of letting idle connections accumulate.

MaxConcurrentQueriesPerConnection

DnsServerOptions.cs

Gets or sets how many queries a single connection may have in flight at once. Defaults to 16.

public int MaxConcurrentQueriesPerConnection { get; set; }

Property value

int

MaxUdpResponseSize

DnsServerOptions.cs

Gets or sets the largest UDP response the server will send, in bytes. A client's advertised EDNS payload size is clamped to this value; larger answers are truncated so the client retries over TCP. Defaults to 1232 bytes, the size recommended by DNS Flag Day 2020, which also limits how much a spoofed query can amplify.

public int MaxUdpResponseSize { get; set; }

Property value

int

QuicIdleTimeout

DnsServerOptions.cs

Gets or sets how long a DNS over QUIC connection may stay idle before it is closed. Defaults to 30 seconds.

public TimeSpan QuicIdleTimeout { get; set; }

Property value

TimeSpan

TcpIdleTimeout

DnsServerOptions.cs

Gets or sets how long a TCP or DNS over TLS connection may sit without a complete query before the server closes it (RFC 7766 6.2.3). Defaults to 30 seconds. Use Timeout.InfiniteTimeSpan to disable, at the cost of letting idle connections accumulate.

public TimeSpan TcpIdleTimeout { get; set; }

Property value

TimeSpan

Methods

NameDescription
AddQuicListener(int, X509Certificate2, IPAddress?)Adds a DNS over QUIC listener on the specified port.
AddTcpListener(int, IPAddress?)Adds a TCP listener on the specified port.
AddTlsListener(int, X509Certificate2, IPAddress?)Adds a DNS over TLS listener on the specified port.
AddUdpListener(int, IPAddress?)Adds a UDP listener on the specified port.

AddQuicListener(int, X509Certificate2, IPAddress?)

DnsServerOptions.cs

Adds a DNS over QUIC listener on the specified port.

public DnsServerOptions AddQuicListener(int port, X509Certificate2 certificate, IPAddress? bindAddress = null)

Parameters

port int
certificate X509Certificate2
bindAddress IPAddress?

Returns

DnsServerOptions

AddTcpListener(int, IPAddress?)

DnsServerOptions.cs

Adds a TCP listener on the specified port.

public DnsServerOptions AddTcpListener(int port = 53, IPAddress? bindAddress = null)

Parameters

port int
bindAddress IPAddress?

Returns

DnsServerOptions

AddTlsListener(int, X509Certificate2, IPAddress?)

DnsServerOptions.cs

Adds a DNS over TLS listener on the specified port.

public DnsServerOptions AddTlsListener(int port, X509Certificate2 certificate, IPAddress? bindAddress = null)

Parameters

port int
certificate X509Certificate2
bindAddress IPAddress?

Returns

DnsServerOptions

AddUdpListener(int, IPAddress?)

DnsServerOptions.cs

Adds a UDP listener on the specified port.

public DnsServerOptions AddUdpListener(int port = 53, IPAddress? bindAddress = null)

Parameters

port int
bindAddress IPAddress?

Returns

DnsServerOptions