Skip to content

Commit

Permalink
dnsdist: Yet more descriptions in the YAML documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
rgacogne committed Jan 14, 2025
1 parent 4fbfdd6 commit 92c8679
Show file tree
Hide file tree
Showing 6 changed files with 439 additions and 193 deletions.
2 changes: 1 addition & 1 deletion pdns/dnsdistdist/dnsdist-configuration-yaml.cc
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,6 @@ static std::shared_ptr<DownstreamState> createBackendFromConfiguration(const dns
backendConfig.d_qpsLimit = config.queries_per_second;
backendConfig.order = config.order;
backendConfig.d_weight = config.weight;
backendConfig.d_retries = config.retries;
backendConfig.d_maxInFlightQueriesPerConn = config.max_in_flight;
backendConfig.d_tcpConcurrentConnectionsLimit = config.max_concurrent_tcp_connections;
backendConfig.name = std::string(config.name);
Expand All @@ -377,6 +376,7 @@ static std::shared_ptr<DownstreamState> createBackendFromConfiguration(const dns
backendConfig.d_cpus = getCPUPiningFromStr("backend", std::string(config.cpus));
backendConfig.d_tcpOnly = config.tcp_only;

backendConfig.d_retries = config.tcp.retries;
backendConfig.tcpConnectTimeout = config.tcp.connect_timeout;
backendConfig.tcpSendTimeout = config.tcp.send_timeout;
backendConfig.tcpRecvTimeout = config.tcp.receive_timeout;
Expand Down
21 changes: 3 additions & 18 deletions pdns/dnsdistdist/dnsdist-rust-lib/rust/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1490,8 +1490,6 @@ mod dnsdistsettings {
#[serde(default, skip_serializing_if = "crate::is_default")]
certificates: Vec<IncomingTlsCertificateKeyPairConfiguration>,
#[serde(default, skip_serializing_if = "crate::is_default")]
ignore_errors: bool,
#[serde(default, skip_serializing_if = "crate::is_default")]
ciphers: String,
#[serde(default, skip_serializing_if = "crate::is_default")]
ciphers_tls_13: String,
Expand Down Expand Up @@ -1584,7 +1582,7 @@ mod dnsdistsettings {
paths: Vec<String>,
#[serde(default = "crate::U64::<30>::value", skip_serializing_if = "crate::U64::<30>::is_equal")]
idle_timeout: u64,
#[serde(default = "crate::default_value_incoming_doh_server_tokens", skip_serializing_if = "crate::default_value_equal_incoming_doh_server_tokens")]
#[serde(default, skip_serializing_if = "crate::is_default")]
server_tokens: String,
#[serde(default = "crate::Bool::<true>::value", skip_serializing_if = "crate::if_true")]
send_cache_control_headers: bool,
Expand Down Expand Up @@ -1697,6 +1695,8 @@ mod dnsdistsettings {
#[derive(Deserialize, Serialize, Debug, PartialEq)]
#[serde(deny_unknown_fields)]
struct OutgoingTcpConfiguration {
#[serde(default = "crate::U16::<5>::value", skip_serializing_if = "crate::U16::<5>::is_equal")]
retries: u16,
#[serde(default = "crate::U16::<5>::value", skip_serializing_if = "crate::U16::<5>::is_equal")]
connect_timeout: u16,
#[serde(default = "crate::U16::<30>::value", skip_serializing_if = "crate::U16::<30>::is_equal")]
Expand Down Expand Up @@ -1810,8 +1810,6 @@ mod dnsdistsettings {
weight: u32,
#[serde(default, skip_serializing_if = "crate::is_default")]
pools: Vec<String>,
#[serde(default = "crate::U16::<5>::value", skip_serializing_if = "crate::U16::<5>::is_equal")]
retries: u16,
#[serde(default, skip_serializing_if = "crate::is_default")]
tcp: OutgoingTcpConfiguration,
#[serde(default = "crate::Bool::<true>::value", skip_serializing_if = "crate::if_true")]
Expand All @@ -1835,12 +1833,8 @@ mod dnsdistsettings {
#[serde(default, skip_serializing_if = "crate::is_default")]
max_concurrent_tcp_connections: u32,
#[serde(default, skip_serializing_if = "crate::is_default")]
ktls: bool,
#[serde(default, skip_serializing_if = "crate::is_default")]
proxy_protocol_advertise_tls: bool,
#[serde(default, skip_serializing_if = "crate::is_default")]
xsk_sockets: Vec<String>,
#[serde(default, skip_serializing_if = "crate::is_default")]
mac_address: String,
#[serde(default, skip_serializing_if = "crate::is_default")]
cpus: String,
Expand Down Expand Up @@ -2817,15 +2811,6 @@ fn default_value_equal_incoming_doh_provider(value: &str)-> bool {
}


// DEFAULT HANDLING for incoming_doh_server_tokens
fn default_value_incoming_doh_server_tokens() -> String {
String::from("h2o/dnsdist")
}
fn default_value_equal_incoming_doh_server_tokens(value: &str)-> bool {
value == default_value_incoming_doh_server_tokens()
}


impl Default for dnsdistsettings::IncomingDohConfiguration {
fn default() -> Self {
let deserialized: dnsdistsettings::IncomingDohConfiguration = serde_yaml::from_str("").unwrap();
Expand Down
Loading

0 comments on commit 92c8679

Please sign in to comment.