#dns #smtp #email

mxdns

DNS utilities for SMTP servers

3 unstable releases

✓ Uses Rust 2018 edition

0.2.1 Mar 13, 2019
0.2.0 Mar 3, 2019
0.1.0 Jan 19, 2019

#48 in Email

Download history 7/week @ 2019-01-15 6/week @ 2019-01-22 1/week @ 2019-01-29 1/week @ 2019-02-05 3/week @ 2019-02-19 13/week @ 2019-02-26 2/week @ 2019-03-05

12 downloads per month

MIT/Apache

19KB
432 lines

MX DNS

DNS utilities for mail servers. Currently this crate supports reverse DNS lookups and lookups against dns based blocklists.

Example

use mxdns::{MxDns, FCrDNS};

let blocklists = vec!["zen.spamhaus.org.","dnsbl-1.uceprotect.net."];
let mxdns = MxDns::new(blocklists).unwrap();

// Check if an IP Address is present on blocklists
let is_blocked = mxdns.is_blocked([127, 0, 0, 2]).unwrap();
assert!(is_blocked);

// Reverse lookup a DNS address
let rdns = mxdns.reverse_dns([193, 25, 101, 5]).unwrap().unwrap();
assert_eq!(rdns, "mail.alienscience.org.");

// Check that the ip resolved from the name obtained by the reverse dns matches the ip
if let Ok(FCrDNS::Confirmed(_domain)) = mxdns.fcrdns([193, 25, 101, 5]) {
   // _domain is Confirmed
}

lib.rs:

DNS utilities for email servers.

Currently, DNS based blocklists and reverse DNS lookups are supported. The crate also supports forward confirmed reverse dns checks.

Because blocklists are IP4 based, these utilities only support IP4 addresses. IP6 addresses are converted to IP4 when possible.

Examples

use mxdns::{MxDns, FCrDNS};

let blocklists = vec!["zen.spamhaus.org.","dnsbl-1.uceprotect.net."];
let mxdns = MxDns::new(blocklists).unwrap();

// Check if an IP Address is present on blocklists
let is_blocked = mxdns.is_blocked([127, 0, 0, 2]).unwrap();
assert!(is_blocked);

// Reverse lookup a DNS address
let rdns = mxdns.reverse_dns([193, 25, 101, 5]).unwrap().unwrap();
assert_eq!(rdns, "mail.alienscience.org.");

// Check that the ip resolved from the name obtained by the reverse dns matches the ip
if let Ok(FCrDNS::Confirmed(_domain)) = mxdns.fcrdns([193, 25, 101, 5]) {
   // _domain is Confirmed
}

Dependencies

~8.5MB
~148K SLoC