pub struct DnsConfig {
pub zone: String,
pub port: u16,
pub bind_addr: IpAddr,
pub upstreams: Option<Vec<SocketAddr>>,
}Expand description
Configuration for DNS integration with overlay network
Fields§
§zone: StringDNS zone (e.g., “overlay.local.”)
port: u16DNS server port (default: 15353)
bind_addr: IpAddrBind address (default: overlay IP)
upstreams: Option<Vec<SocketAddr>>Explicit upstream resolvers for non-overlay queries.
When Some, this list wins outright over any host-resolver detection:
the overlay DNS server forwards every query outside Self::zone to
these addresses (in order) and never consults /etc/resolv.conf. This
is the production-safe override for hosts where a mesh VPN (netbird,
Tailscale, …) has hijacked systemd-resolved with a ~. catch-all and
poisoned the host resolver for everything else.
When None (the default), the server detects upstreams at startup by
parsing /etc/resolv.conf and filtering out loopback / resolved-stub
addresses; see [resolve_upstreams] for the exact precedence and the
public fallback.
Each entry is a full SocketAddr so a non-standard upstream port can be
expressed; detection synthesises port [STANDARD_DNS_PORT] (53).
Implementations§
Source§impl DnsConfig
impl DnsConfig
Sourcepub fn with_upstreams(self, upstreams: Vec<SocketAddr>) -> Self
pub fn with_upstreams(self, upstreams: Vec<SocketAddr>) -> Self
Set explicit upstream resolvers for non-overlay queries.
Supplying this disables host-resolver auto-detection entirely (the
config override always wins). Pass full SocketAddrs; for the common
case of “this IP on port 53” build them as SocketAddr::new(ip, 53).
Trait Implementations§
Source§impl<'de> Deserialize<'de> for DnsConfig
impl<'de> Deserialize<'de> for DnsConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for DnsConfig
impl RefUnwindSafe for DnsConfig
impl Send for DnsConfig
impl Sync for DnsConfig
impl Unpin for DnsConfig
impl UnsafeUnpin for DnsConfig
impl UnwindSafe for DnsConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> FromBase64 for Twhere
T: for<'de> Deserialize<'de>,
impl<T> FromBase64 for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more