cni_plugin/
dns.rs

1use std::net::IpAddr;
2
3use serde::{Deserialize, Serialize};
4
5/// DNS configuration or settings.
6///
7/// Some plugins may make use of this. While the schema is set, it is not a part
8/// of the spec formally, and plugins are only required to respect their
9/// intended semantics if they care about these.
10///
11/// All fields are optional ([`Vec`]s will default to empty).
12#[derive(Clone, Debug, Default, Deserialize, Serialize)]
13#[serde(rename_all = "camelCase")]
14pub struct Dns {
15	/// List of DNS nameservers this network is aware of.
16	///
17	/// The list is priority-ordered.
18	#[serde(default, skip_serializing_if = "Vec::is_empty")]
19	pub nameservers: Vec<IpAddr>,
20
21	/// The local domain used for short hostname lookups.
22	#[serde(default, skip_serializing_if = "Option::is_none")]
23	pub domain: Option<String>,
24
25	/// List of search domains for short hostname lookups.
26	///
27	/// This effectively supersedes the `domain` field and will be preferred
28	/// over it by most resolvers.
29	///
30	/// The list is priority-ordered.
31	#[serde(default, skip_serializing_if = "Vec::is_empty")]
32	pub search: Vec<String>,
33
34	/// List of options to be passed to the resolver.
35	#[serde(default, skip_serializing_if = "Vec::is_empty")]
36	pub options: Vec<String>,
37}