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

#30 in #domain

32 downloads per month
Used in dominion-chat

MPL-2.0 license

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

~335–790KB
~19K SLoC