pub struct DnsSinkhole { /* private fields */ }Expand description
Local DNS authority that swallows lookups for disallowed / unknown names.
All agent DNS goes here first (PRODUCT.md B.5 step 1). Combined with the signed auto-updating IOC feed it blunts C2 over freshly-registered domains (PRODUCT.md Part D row “C2 over a freshly-registered domain”: “Signed auto-updating feed + DNS sinkhole + destination-entropy anomaly”).
Fail-closed: an unknown name resolves to a sinkhole / NXDOMAIN, never to the
real address (PRODUCT.md W0).
Implementations§
Source§impl DnsSinkhole
impl DnsSinkhole
Sourcepub fn new() -> Self
pub fn new() -> Self
Construct a fail-closed DNS sinkhole with an empty allowlist (PRODUCT.md W0).
Sourcepub fn with_allowlist(
self,
hosts: impl IntoIterator<Item = impl Into<String>>,
) -> Self
pub fn with_allowlist( self, hosts: impl IntoIterator<Item = impl Into<String>>, ) -> Self
Set the egress allowlist — only these hostnames are forwarded upstream.
Sourcepub fn with_upstream(self, addr: SocketAddr) -> Self
pub fn with_upstream(self, addr: SocketAddr) -> Self
Override the upstream recursive resolver (default 8.8.8.8:53).
Sourcepub async fn start(&self, addr: SocketAddr) -> Result<()>
pub async fn start(&self, addr: SocketAddr) -> Result<()>
Bind the sinkhole on addr (UDP) and serve until cancelled.
For each query (PRODUCT.md B.5 step 1):
- Hostname in allowlist → forward to upstream resolver.
- Hostname not in allowlist → NXDOMAIN (fail-closed, PRODUCT.md W0).
- Parse/protocol error → SERVFAIL and drop.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for DnsSinkhole
impl RefUnwindSafe for DnsSinkhole
impl Send for DnsSinkhole
impl Sync for DnsSinkhole
impl Unpin for DnsSinkhole
impl UnsafeUnpin for DnsSinkhole
impl UnwindSafe for DnsSinkhole
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> 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