package dns-client

  1. Overview
  2. Docs
Pure DNS resolver API

Install

Dune Dependency

Authors

Maintainers

Sources

dns-v4.4.1.tbz
sha256=c8b2a49485c7a1bed06c3be47c80c6e865728e3f6658407e179bc5099c4c80a1
sha512=f9997cf9bbe4705ff9d49b3b69300cf5eec12c79bec68e32e20c0356e10fb9e7a150b08e627e429d2eaaf35befcdbabc738dff8535a763e7c57d825d006e21ea

doc/dns-client.unix/Dns_client_unix/Transport/index.html

Module Dns_client_unix.TransportSource

A flow module based on blocking I/O on top of the Unix socket API.

A flow is a network connection initialized by T.connect

Sourcetype +'a io = 'a

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

Sourcetype io_addr = Unix.inet_addr * int

An address for a given flow type, usually this will consist of IP address + a TCP/IP or UDP/IP port number, but for some flow 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 flow 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 : ?rng:(int -> Cstruct.t) -> ?nameserver:ns_addr -> stack -> t

create ~rng ~nameserver stack creates the state record of the DNS client.

Sourceval nameserver : t -> ns_addr

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

Sourceval rng : t -> int -> Cstruct.t

rng t is a random number generator.

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

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

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

send flow buffer sends buffer to the flow upstream.

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

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

Sourceval close : flow -> unit io

close flow closes the flow, freeing up resources.

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

a.k.a. >>=

Sourceval lift : 'a -> 'a io
OCaml

Innovation. Community. Security.