diff --git a/src/idns/client.rs b/src/idns/client.rs index 205e7dc..927d6e6 100644 --- a/src/idns/client.rs +++ b/src/idns/client.rs @@ -82,6 +82,7 @@ impl Client { &self, request: RequestMessage>, server: &Server, ) -> Result { match server.transport { + Transport::Udp => self.request_udp(request, server).await, Transport::UdpTcp => self.request_udptcp(request, server).await, Transport::Tcp => self.request_tcp(request, server).await, } @@ -158,6 +159,7 @@ pub struct Server { #[derive(Clone, Copy, Debug)] pub enum Transport { + Udp, UdpTcp, Tcp, } diff --git a/src/idns/commands/query.rs b/src/idns/commands/query.rs index 87caefc..bacec7b 100644 --- a/src/idns/commands/query.rs +++ b/src/idns/commands/query.rs @@ -54,6 +54,10 @@ pub struct Query { #[arg(short, long)] tcp: bool, + /// Use only UDP. + #[arg(short, long)] + udp: bool, + /// Set the timeout for a query. #[arg(long, value_name="SECONDS")] timeout: Option, @@ -217,7 +221,10 @@ impl Query { } fn transport(&self) -> Transport { - if self.tcp { + if self.udp { + Transport::Udp + } + else if self.tcp { Transport::Tcp } else {