#w5500 #dns #wiznet #dns-server #server-client

no-std w5500-dns

DNS client for the Wiznet W5500 internet offload chip

7 releases (4 breaking)

0.5.0 Jun 9, 2024
0.4.0 Oct 2, 2023
0.3.0 Aug 6, 2023
0.2.0 May 14, 2022
0.1.0-alpha.0 Mar 20, 2022

#638 in Embedded development

Download history 1/week @ 2024-07-25 3/week @ 2024-08-08 6/week @ 2024-08-15 13/week @ 2024-08-22 39/week @ 2024-08-29 32/week @ 2024-09-05 40/week @ 2024-09-12 55/week @ 2024-09-19 50/week @ 2024-09-26 9/week @ 2024-10-03 5/week @ 2024-10-10 22/week @ 2024-10-17 7/week @ 2024-10-24 43/week @ 2024-10-31 24/week @ 2024-11-07

97 downloads per month

MIT license

130KB
2K SLoC

w5500-dns

DNS client for the Wiznet W5500 SPI internet offload chip.

Warning

Please proceed with caution, and review the code before use in a production environment.

This code was developed for one-off hobby projects.

Limitations

  • No DNS caching.
  • Only supports A queries.
  • Only supports a single outstanding query.
  • Only supports a single question in a query.

Example

use w5500_dns::{hl::block, ll::Sn, servers, Client as DnsClient, Hostname, Response};

const DNS_SOCKET: Sn = Sn::Sn3;
const DNS_SRC_PORT: u16 = 45917;

let mut dns_client: DnsClient =
    DnsClient::new(DNS_SOCKET, DNS_SRC_PORT, servers::CLOUDFLARE, random_number);
let hostname: Hostname = Hostname::new("docs.rs").expect("hostname is invalid");

let mut hostname_buffer: [u8; 16] = [0; 16];

let query_id: u16 = dns_client.a_question(&mut w5500, &hostname)?;
let mut response: Response<_> =
    block!(dns_client.response(&mut w5500, &mut hostname_buffer, query_id))?;

while let Some(rr) = response.next_rr()? {
    println!("name: {:?}", rr.name);
    println!("TTL: {}", rr.ttl);
    println!("IP: {:?}", rr.rdata);
}
response.done()?;

Relevant Specifications

Feature Flags

All features are disabled by default.

  • eh0: Passthrough to w5500-hl.
  • eh1: Passthrough to w5500-hl.
  • defmt: Enable logging with defmt. Also a passthrough to w5500-hl.
  • log: Enable logging with log.

Dependencies

~340–520KB