barnacle/dns

Types

pub type IpAddress {
  IpV4(Int, Int, Int, Int)
  IpV6(Int, Int, Int, Int, Int, Int, Int, Int)
}

Constructors

  • IpV4(Int, Int, Int, Int)
  • IpV6(Int, Int, Int, Int, Int, Int, Int, Int)

A DNS error that can occur when discovering nodes.

pub type LookupError {
  FormatError
  QueryFormatError
  ServerFailure
  NoSuchDomain
  Timeout
  NotImplemented
  Refused
  BadVersion
  PosixError(String)
  Unknown
}

Constructors

  • FormatError
  • QueryFormatError
  • ServerFailure
  • NoSuchDomain
  • Timeout
  • NotImplemented
  • Refused
  • BadVersion
  • PosixError(String)
  • Unknown

Functions

pub fn discover_nodes(
  basename: String,
  hostname_query: String,
  timeout: Int,
) -> Result(List(Atom), LookupError)

Discover nodes using DNS. The first argument is the basename of the nodes. Currently, Barnacle only supports connecting to nodes with the same basename.

The second argument is the hostname to query against. Both A and AAAA records will be queried. The final argument is an optional timeout for the DNS lookup. This defaults to 5000ms if not supplied.

pub fn dns_lookup(
  hostname: String,
  timeout: Int,
) -> Result(List(IpAddress), LookupError)

Perform a DNS lookup against a hostname. This will return a list of IP addresses. Queries will be performed using the A and AAAA record types.

Search Document