global::dns

Functions used to query the DNS.

fn lookup

fn lookup(name: SharedObject) -> Array
fn lookup(name: String) -> Array
Performs a dual-stack DNS lookup for the given hostname.
  • host - A valid hostname to search.
  • array - an array of IPs. The array is empty if no IPs were found for the host.

All of them.

  • Root resolver was not found.
  • Lookup failed.
#{
  preq: [
    action "lookup recipients" || {
      let domain = "gmail.com";
      let ips = dns::lookup(domain);

      print(`ips found for ${domain}`);
      for ip in ips { print(`- ${ip}`); }
    },
  ],
}

fn rlookup

fn rlookup(name: String) -> Array
fn rlookup(name: SharedObject) -> Array
Performs a reverse lookup for the given IP.
  • ip - The IP to query.
  • array - an array of FQDNs. The array is empty if nothing was found.

All of them.

  • Failed to convert the ip parameter from a string into an IP.
  • Reverse lookup failed.
#{
  connect: [
    rule "rlookup" || {
      state::accept(`250 client ip: ${"127.0.0.1"} -> ${dns::rlookup("127.0.0.1")}`);
    }
  ],
}