gleewhois

Library to query WHOIS servers from Gleam, using the mug Gleam TCP client.

Types

Error types returned from query.

pub type Err {
  SocketError
  ParsingError
  UnknownError
}

Constructors

  • SocketError
  • ParsingError
  • UnknownError

Functions

pub fn main() -> Nil

Entrypoint for running CLI program.

pub fn query(
  query: String,
  server server: String,
  port port: Int,
  timeout_ms timeout_ms: Int,
) -> Result(String, Err)

Query a WHOIS server, e.g.

query("AS51019", server: "whois.ripe.net", port: 43, timeout_ms: 60_000)

or for a domain name:

query("ospf.se", server: "whois.iis.se", port: 43, timeout_ms: 60_000)

You can find the WHOIS server for any TLD from whois.iana.org, you could even do it with this library:

query("se", server: "whois.iana.org", port: 43, timeout_ms: 60_000)

and programmatically obtain the WHOIS server for any TLD, to query for any domain name.

Search Document