package dns-client

  1. Overview
  2. Docs
Pure DNS resolver API

Install

Dune Dependency

Authors

Maintainers

Sources

dns-v5.0.1.tbz
sha256=72c0a1a91c8e409bd448c8e0ea28d16d13177c326aea403ee1c30ddcb5969adc
sha512=f5067d4ef6aca863bd06e6721a63a03da80052ab8e361440e72fae07ca45773763e0321236c6810afe80bd679d68763dc63fb57aec2e953173cc9a944785c93c

doc/dns-client.lwt/Dns_client_lwt/Transport/index.html

Module Dns_client_lwt.TransportSource

A flow module based on non-blocking I/O on top of the Lwt_unix socket API.

Sourcetype context

A context is a network connection initialized by T.connect

Sourcetype +'a io = 'a Lwt.t

io is the type of an effect. 'err is a polymorphic variant.

Sourcetype io_addr = Ipaddr.t * int

An address for a given context type, usually this will consist of IP address + a TCP/IP or UDP/IP port number, but for some context types it can carry additional information for purposes of cryptographic verification. TODO at least that would be nice in the future. TODO

Sourcetype ns_addr = [ `TCP | `UDP ] * io_addr

TODO well this is kind of crude; it's a tuple to prevent having to do endless amounts of currying things when implementing context types, and we need to know the protocol used so we can prefix packets for DNS-over-TCP and set correct socket options etc. therefore we can't just use the opaque io_addr. TODO

Sourcetype stack = unit

A stack with which to connect, e.g. IPv4.tcpv4

Sourcetype t

The abstract state of a DNS client.

Sourceval create : ?nameserver:ns_addr -> timeout:int64 -> stack -> t

create ~nameserver ~timeout stack creates the state record of the DNS client. We use timeout (ns) as a cumulative time budget for connect and request timeouts.

Sourceval nameserver : t -> ns_addr

The address of a nameserver that is supposed to work with the underlying context, can be used if the user does not want to bother with configuring their own.

Sourceval rng : int -> Cstruct.t

rng t is a random number generator.

Sourceval clock : unit -> int64

clock t is the monotonic clock.

Sourceval connect : ?nameserver:ns_addr -> t -> (context, [> `Msg of string ]) result io

connect addr is a new connection (context) to addr, or an error.

Sourceval send : context -> Cstruct.t -> (unit, [> `Msg of string ]) result io

send context buffer sends buffer to the context upstream.

Sourceval recv : context -> (Cstruct.t, [> `Msg of string ]) result io

recv context tries to read a buffer from the context downstream.

Sourceval close : context -> unit io

close context closes the context, freeing up resources.

Sourceval bind : 'a io -> ('a -> 'b io) -> 'b io

a.k.a. >>=

Sourceval lift : 'a -> 'a io
OCaml

Innovation. Community. Security.