4 releases (breaking)
0.4.0 | Feb 3, 2023 |
---|---|
0.3.0 | Aug 5, 2022 |
0.2.0 | Jul 25, 2022 |
0.1.0 | Jul 23, 2022 |
#10 in #questions
Used in dominion-chat
66KB
1K
SLoC
Dominion
A crate to implement DNS [Server]s and clients.
Server
use dominion::{Server, ServerService, DnsPacket};
use std::net::SocketAddr;
struct Echo;
impl ServerService for Echo {
fn run<'a>(&self, _client: SocketAddr, question: DnsPacket<'a>) -> Option<DnsPacket<'a>> { Some(question) }
}
Server::default()
.bind("127.0.0.1:5353".parse().unwrap())
.unwrap()
.serve(Echo);
Client
lib.rs
:
Dominion
A crate to implement DNS [Server]s and clients.
Server
use dominion::{Server, ServerService, DnsPacket};
use std::net::SocketAddr;
struct Echo;
impl ServerService for Echo {
fn run<'a>(&self, _client: SocketAddr, question: &'a DnsPacket<'a>) -> Option<DnsPacket<'a>> { Some(question.clone()) }
}
Server::default()
.bind("127.0.0.1:5353".parse().unwrap())
.unwrap()
.serve(Echo);
Client
Dependencies
~220–670KB
~16K SLoC