dnsstamps

  Source   Edit

An implementation of DNS stamps as described at: https://dnscrypt.info/stamps-specifications

Types

Protocol = enum
  protoDns = "DNS", protoDnsCrypt = "DNSCrypt",
  protoDnsOverHttps = "DNS-over-HTTPS", protoDnsOverTls = "DNS-over-TLS",
  protoDnsCryptRelay = "Anonymized DNSCrypt relay"

Protocol of the DNS server.

See also:

  • toInt for getting the integer identifier of the protocol.
  • intToProtocol for converting an integer to Protocol.
  Source   Edit
Properties = enum
  propDnssec = "DNSSEC", propNoLog = "No logs", propNoFilter = "No filter"
Informal properties of the DNS server.   Source   Edit
Stamp = object
  address*: string           ## The IP address (and/or port) to the server.
  props*: set[Properties]    ## The set of informal properties of the server
  case proto*: Protocol      ## The protocol of the stamp.
  of protoDnsCrypt:
      providerName*: string  ## The name of the DNSCrypt provider
      publicKey*: array[32, byte] ## The Ed25519 public key of the provider
    
  of protoDnsOverHttps, protoDnsOverTls:
      hashes*: seq[array[32, byte]] ## The list of SHA256 digests of the TBS certificates in the
                                    ## certification chain. Should not be empty.
      hostname*, path*: string ## Hostname and path to the resolver.
                               ## Hostname must not be empty.
                               ## Path is ignored for DNS-over-TLS stamps.
      bootstrapIps*: seq[string] ## The list of regular DNS resolvers recommended for resolving the
                                 ## hostname if no IP address is provided. Can be empty.
    
  else:
      nil

  
The structured representation of a DNS server stamp.   Source   Edit

Procs

proc addStamp(s: var string; stamp: Stamp) {...}{.raises: [], tags: [].}
Append the string representaton of stamp to s.   Source   Edit
proc `$`(stamp: Stamp): string {...}{.inline, raises: [], tags: [].}
Convert stamp into its string representation.   Source   Edit

Funcs

func toInt(protocol: Protocol): int {...}{.inline, raises: [], tags: [].}
Returns the integer identifier of the given protocol.   Source   Edit
func intToProtocol(i: int): Protocol {...}{.inline, raises: [ValueError], tags: [].}

Returns the Protocol corresponding to the given integer i.

Raises ValueError if i is not a valid protocol identifier.

  Source   Edit
func isRelay(protocol: Protocol): bool {...}{.inline, raises: [], tags: [].}
Returns whether the given protocol is a relay type.   Source   Edit
func initDnsStamp(address: string; props: set[Properties] = {}): Stamp {...}{.inline,
    raises: [], tags: [].}
Create a DNS server stamp.
address: The IP address of the resolver, must not be empty.
props: The set of informal Properties of the resolver.
  Source   Edit
func initDnsCryptStamp(address: string; publicKey: openArray[byte];
                       providerName: string; props: set[Properties] = {}): Stamp {...}{.
    inline, raises: [], tags: [].}
Create a DNSCrypt server stamp.
address:The IP address of the resolver with an optional port number if not reachable via the standard port (443), must not be empty.
publicKey:The provider's Ed25519 public key in bytes. The array must be exactly 32 bytes in size.
providerName: The name of the provider, must not be empty.
props: The set of informal Properties of the resolver.
  Source   Edit
func initDoHStamp(address: string = ""; hashes: openArray[array[32, byte]];
                  hostname: string; path = "/dns-query";
                  bootstrapIps: openArray[string] = [];
                  props: set[Properties] = {}): Stamp {...}{.inline, raises: [],
    tags: [].}
Create a DNS-over-HTTPS server stamp.
address:The IP address of the resolver. Can be empty or just a port number represented with a preceding colon (eg. :443).
hashes:List of SHA256 digests of the TBS certificates found in the verification chain, typically the certificates used to sign the resolver's certificate. At least one hash must be present.
hostname: The server host name, must not be empty.
path: The absolute URI path to the resolver (eg. /dns-query).
bootstrapIps:The list of IP addresses of recommended resolvers accessible over standard DNS in order to resolve hostname.
props: The set of informal Properties of the resolver.
  Source   Edit
func initDoTStamp(address: string; hashes: openArray[array[32, byte]];
                  hostname: string; bootstrapIps: openArray[string] = [];
                  props: set[Properties] = {}): Stamp {...}{.inline, raises: [],
    tags: [].}
Create a DNS-over-TLS server stamp.
address:The IP address of the resolver. Can be empty or just a port number represented with a preceding colon (eg. :853).
hashes:List of SHA256 digests of the TBS certificates found in the verification chain, typically the certificates used to sign the resolver's certificate. At least one hash must be present.
hostname: The server host name, must not be empty.
bootstrapIps:The list of IP addresses of recommended resolvers accessible over standard DNS in order to resolve hostname.
props: The set of informal Properties of the resolver.
  Source   Edit
func initDnsCryptRelayStamp(address: string): Stamp {...}{.inline, raises: [],
    tags: [].}
Create an Anonymized DNSCrypt relay stamp.
address: The IP address of the relay, must not be empty.
  Source   Edit