Skip to content

Commit

Permalink
Update happy-eyeballs doc to 1.1.0.
Browse files Browse the repository at this point in the history
  • Loading branch information
hannesm committed May 27, 2024
1 parent 2a72e18 commit e9c4f07
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 14 deletions.
19 changes: 16 additions & 3 deletions happy-eyeballs-lwt/Happy_eyeballs_lwt/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,32 @@
<span>unit <span class="arrow">&#45;&gt;</span></span>
<a href="#type-t">t</a></span></code></div><div class="spec-doc"><p><code>create ~happy_eyeballs ~getaddrinfo ~timer_interval ()</code> creates an initial state of happy eyeballs with the specified timeouts in nanoseconds - the default for <code>timer_interval</code> is <code>Duration.of_ms 10</code>.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-connect_host"><a href="#val-connect_host" class="anchor"></a><code><span><span class="keyword">val</span> connect_host :
<span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span>
<span><span class="optlabel">?aaaa_timeout</span>:int64 <span class="arrow">&#45;&gt;</span></span>
<span><span class="optlabel">?connect_delay</span>:int64 <span class="arrow">&#45;&gt;</span></span>
<span><span class="optlabel">?connect_timeout</span>:int64 <span class="arrow">&#45;&gt;</span></span>
<span><span class="optlabel">?resolve_timeout</span>:int64 <span class="arrow">&#45;&gt;</span></span>
<span><span class="optlabel">?resolve_retries</span>:int <span class="arrow">&#45;&gt;</span></span>
<span><span><span>[ `host ]</span> <span class="xref-unresolved">Domain_name</span>.t</span> <span class="arrow">&#45;&gt;</span></span>
<span><span>int list</span> <span class="arrow">&#45;&gt;</span></span>
<span><span><span>(<span>(<span class="xref-unresolved">Ipaddr</span>.t * int)</span> * <span class="xref-unresolved">Lwt_unix</span>.file_descr, <span>[ <span>`Msg of string</span> ]</span>)</span> <span class="xref-unresolved">Stdlib</span>.result</span>
<span class="xref-unresolved">Lwt</span>.t</span></span></code></div><div class="spec-doc"><p><code>connect_host t host ports</code> establishes a connection to <code>host</code> on <code>ports</code> (tried in sequence).</p><ul class="at-tags"><li class="raises"><span class="at-tag">raises</span> <code>Failure</code> <p>if <code>ports</code> is empty.</p></li></ul></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-connect_ip"><a href="#val-connect_ip" class="anchor"></a><code><span><span class="keyword">val</span> connect_ip :
<span class="xref-unresolved">Lwt</span>.t</span></span></code></div><div class="spec-doc"><p><code>connect_host t host ports</code> establishes a connection to <code>host</code> on <code>ports</code> (tried in sequence). The timeouts and delays are specified in nanoseconds, and are by default the values defined when constructing <code>t</code>.</p><ul class="at-tags"><li class="raises"><span class="at-tag">raises</span> <code>Failure</code> <p>if <code>ports</code> is empty.</p></li></ul></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-connect_ip"><a href="#val-connect_ip" class="anchor"></a><code><span><span class="keyword">val</span> connect_ip :
<span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span>
<span><span class="optlabel">?aaaa_timeout</span>:int64 <span class="arrow">&#45;&gt;</span></span>
<span><span class="optlabel">?connect_delay</span>:int64 <span class="arrow">&#45;&gt;</span></span>
<span><span class="optlabel">?connect_timeout</span>:int64 <span class="arrow">&#45;&gt;</span></span>
<span><span><span>(<span class="xref-unresolved">Ipaddr</span>.t * int)</span> list</span> <span class="arrow">&#45;&gt;</span></span>
<span><span><span>(<span>(<span class="xref-unresolved">Ipaddr</span>.t * int)</span> * <span class="xref-unresolved">Lwt_unix</span>.file_descr, <span>[ <span>`Msg of string</span> ]</span>)</span> <span class="xref-unresolved">Stdlib</span>.result</span>
<span class="xref-unresolved">Lwt</span>.t</span></span></code></div><div class="spec-doc"><p><code>connect_ip t addresses</code> establishes a connection to <code>addresses</code>.</p><ul class="at-tags"><li class="raises"><span class="at-tag">raises</span> <code>Failure</code> <p>if <code>addresses</code> is the empty list.</p></li></ul></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-connect"><a href="#val-connect" class="anchor"></a><code><span><span class="keyword">val</span> connect :
<span class="xref-unresolved">Lwt</span>.t</span></span></code></div><div class="spec-doc"><p><code>connect_ip t addresses</code> establishes a connection to <code>addresses</code>. The timeouts and delays are specified in nanoseconds, and are by default the values defined when constructing <code>t</code>.</p><ul class="at-tags"><li class="raises"><span class="at-tag">raises</span> <code>Failure</code> <p>if <code>addresses</code> is the empty list.</p></li></ul></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-connect"><a href="#val-connect" class="anchor"></a><code><span><span class="keyword">val</span> connect :
<span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span>
<span><span class="optlabel">?aaaa_timeout</span>:int64 <span class="arrow">&#45;&gt;</span></span>
<span><span class="optlabel">?connect_delay</span>:int64 <span class="arrow">&#45;&gt;</span></span>
<span><span class="optlabel">?connect_timeout</span>:int64 <span class="arrow">&#45;&gt;</span></span>
<span><span class="optlabel">?resolve_timeout</span>:int64 <span class="arrow">&#45;&gt;</span></span>
<span><span class="optlabel">?resolve_retries</span>:int <span class="arrow">&#45;&gt;</span></span>
<span>string <span class="arrow">&#45;&gt;</span></span>
<span><span>int list</span> <span class="arrow">&#45;&gt;</span></span>
<span><span><span>(<span>(<span class="xref-unresolved">Ipaddr</span>.t * int)</span> * <span class="xref-unresolved">Lwt_unix</span>.file_descr, <span>[ <span>`Msg of string</span> ]</span>)</span> <span class="xref-unresolved">Stdlib</span>.result</span>
<span class="xref-unresolved">Lwt</span>.t</span></span></code></div><div class="spec-doc"><p><code>connect t host ports</code> establishes a connection to <code>host</code> on <code>ports</code>, which may be a host name, or an IP address.</p><ul class="at-tags"><li class="raises"><span class="at-tag">raises</span> <code>Failure</code> <p>if <code>ports</code> is the empty list.</p></li></ul></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-inject"><a href="#val-inject" class="anchor"></a><code><span><span class="keyword">val</span> inject : <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> <span><a href="#type-getaddrinfo">getaddrinfo</a> <span class="arrow">&#45;&gt;</span></span> unit</span></code></div><div class="spec-doc"><p><code>inject t getaddrinfo</code> injects a <i>new</i> domain-name resolver into the given happy-eyeballs instance. By default, the happy-eyeballs instance use <code>Lwt_unix.getaddrinfo</code> to be able to resolve domain-name. However, the user can choose to use its own implementation of a DNS resolver (like <code>ocaml-dns</code>).</p><p>So, the <i>ceremony</i> for using happy-eyeballs with your own DNS resolver is to create a happy-eyeballs instance, obtain an instance that can resolve domain names (such as <code>ocaml-dns</code>) and inject the latter's implementation into our first happy-eyeballs instance:</p><pre class="language-ocaml"><code>let _ =
<span class="xref-unresolved">Lwt</span>.t</span></span></code></div><div class="spec-doc"><p><code>connect t host ports</code> establishes a connection to <code>host</code> on <code>ports</code>, which may be a host name, or an IP address. The timeouts and delays are specified in nanoseconds, and are by default the values defined when constructing <code>t</code>.</p><ul class="at-tags"><li class="raises"><span class="at-tag">raises</span> <code>Failure</code> <p>if <code>ports</code> is the empty list.</p></li></ul></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-inject"><a href="#val-inject" class="anchor"></a><code><span><span class="keyword">val</span> inject : <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> <span><a href="#type-getaddrinfo">getaddrinfo</a> <span class="arrow">&#45;&gt;</span></span> unit</span></code></div><div class="spec-doc"><p><code>inject t getaddrinfo</code> injects a <i>new</i> domain-name resolver into the given happy-eyeballs instance. By default, the happy-eyeballs instance use <code>Lwt_unix.getaddrinfo</code> to be able to resolve domain-name. However, the user can choose to use its own implementation of a DNS resolver (like <code>ocaml-dns</code>).</p><p>So, the <i>ceremony</i> for using happy-eyeballs with your own DNS resolver is to create a happy-eyeballs instance, obtain an instance that can resolve domain names (such as <code>ocaml-dns</code>) and inject the latter's implementation into our first happy-eyeballs instance:</p><pre class="language-ocaml"><code>let _ =
let dns = Dns_client_lwt.create () in
let happy_eyeballs = Dns_client_lwt.create_happy_eyeballs dns in
Happy_eyeballs_lwt.connect happy_eyeballs &quot;robur.coop&quot; [ 443 ]
Expand Down
19 changes: 16 additions & 3 deletions happy-eyeballs-mirage/Happy_eyeballs_mirage/Make/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,29 @@
<span><a href="#type-stack">stack</a> <span class="arrow">&#45;&gt;</span></span>
<a href="#type-t">t</a></span></code></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-inject"><a href="#val-inject" class="anchor"></a><code><span><span class="keyword">val</span> inject : <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> <span><a href="#type-getaddrinfo">getaddrinfo</a> <span class="arrow">&#45;&gt;</span></span> unit</span></code></div><div class="spec-doc"><p><code>inject t getaddrinfo</code> injects a <i>new</i> domain-name resolver into the given happy-eyeballs instance. By default, the happy-eyeballs instance is not able to resolve hostnames. Use a <code>dns-client-mirage</code> instance at your convenience.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-connect_host"><a href="#val-connect_host" class="anchor"></a><code><span><span class="keyword">val</span> connect_host :
<span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span>
<span><span class="optlabel">?aaaa_timeout</span>:int64 <span class="arrow">&#45;&gt;</span></span>
<span><span class="optlabel">?connect_delay</span>:int64 <span class="arrow">&#45;&gt;</span></span>
<span><span class="optlabel">?connect_timeout</span>:int64 <span class="arrow">&#45;&gt;</span></span>
<span><span class="optlabel">?resolve_timeout</span>:int64 <span class="arrow">&#45;&gt;</span></span>
<span><span class="optlabel">?resolve_retries</span>:int <span class="arrow">&#45;&gt;</span></span>
<span><span><span>[ `host ]</span> <span class="xref-unresolved">Domain_name</span>.t</span> <span class="arrow">&#45;&gt;</span></span>
<span><span>int list</span> <span class="arrow">&#45;&gt;</span></span>
<span><span><span>(<span>(<span class="xref-unresolved">Ipaddr</span>.t * int)</span> * <a href="#type-flow">flow</a>, <span>[&gt; <span>`Msg of string</span> ]</span>)</span> <span class="xref-unresolved">Stdlib</span>.result</span> <span class="xref-unresolved">Lwt</span>.t</span></span></code></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-connect_ip"><a href="#val-connect_ip" class="anchor"></a><code><span><span class="keyword">val</span> connect_ip :
<span><span><span>(<span>(<span class="xref-unresolved">Ipaddr</span>.t * int)</span> * <a href="#type-flow">flow</a>, <span>[&gt; <span>`Msg of string</span> ]</span>)</span> <span class="xref-unresolved">Stdlib</span>.result</span> <span class="xref-unresolved">Lwt</span>.t</span></span></code></div><div class="spec-doc"><p><code>connect_host t host ports</code> establishes a connection to <code>host</code> on <code>ports</code> (tried in sequence). The timeouts and delays are specified in nanoseconds, and are by default the values defined when constructing <code>t</code>.</p><ul class="at-tags"><li class="raises"><span class="at-tag">raises</span> <code>Failure</code> <p>if <code>ports</code> is empty.</p></li></ul></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-connect_ip"><a href="#val-connect_ip" class="anchor"></a><code><span><span class="keyword">val</span> connect_ip :
<span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span>
<span><span class="optlabel">?aaaa_timeout</span>:int64 <span class="arrow">&#45;&gt;</span></span>
<span><span class="optlabel">?connect_delay</span>:int64 <span class="arrow">&#45;&gt;</span></span>
<span><span class="optlabel">?connect_timeout</span>:int64 <span class="arrow">&#45;&gt;</span></span>
<span><span><span>(<span class="xref-unresolved">Ipaddr</span>.t * int)</span> list</span> <span class="arrow">&#45;&gt;</span></span>
<span><span><span>(<span>(<span class="xref-unresolved">Ipaddr</span>.t * int)</span> * <a href="#type-flow">flow</a>, <span>[&gt; <span>`Msg of string</span> ]</span>)</span> <span class="xref-unresolved">Stdlib</span>.result</span> <span class="xref-unresolved">Lwt</span>.t</span></span></code></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-connect"><a href="#val-connect" class="anchor"></a><code><span><span class="keyword">val</span> connect :
<span><span><span>(<span>(<span class="xref-unresolved">Ipaddr</span>.t * int)</span> * <a href="#type-flow">flow</a>, <span>[&gt; <span>`Msg of string</span> ]</span>)</span> <span class="xref-unresolved">Stdlib</span>.result</span> <span class="xref-unresolved">Lwt</span>.t</span></span></code></div><div class="spec-doc"><p><code>connect_ip t addresses</code> establishes a connection to <code>addresses</code>. The timeouts and delays are specified in nanoseconds, and are by default the values defined when constructing <code>t</code>.</p><ul class="at-tags"><li class="raises"><span class="at-tag">raises</span> <code>Failure</code> <p>if <code>addresses</code> is the empty list.</p></li></ul></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-connect"><a href="#val-connect" class="anchor"></a><code><span><span class="keyword">val</span> connect :
<span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span>
<span><span class="optlabel">?aaaa_timeout</span>:int64 <span class="arrow">&#45;&gt;</span></span>
<span><span class="optlabel">?connect_delay</span>:int64 <span class="arrow">&#45;&gt;</span></span>
<span><span class="optlabel">?connect_timeout</span>:int64 <span class="arrow">&#45;&gt;</span></span>
<span><span class="optlabel">?resolve_timeout</span>:int64 <span class="arrow">&#45;&gt;</span></span>
<span><span class="optlabel">?resolve_retries</span>:int <span class="arrow">&#45;&gt;</span></span>
<span>string <span class="arrow">&#45;&gt;</span></span>
<span><span>int list</span> <span class="arrow">&#45;&gt;</span></span>
<span><span><span>(<span>(<span class="xref-unresolved">Ipaddr</span>.t * int)</span> * <a href="#type-flow">flow</a>, <span>[&gt; <span>`Msg of string</span> ]</span>)</span> <span class="xref-unresolved">Stdlib</span>.result</span> <span class="xref-unresolved">Lwt</span>.t</span></span></code></div></div></details></div><div class="odoc-spec"><div class="spec value anchored" id="val-connect_device"><a href="#val-connect_device" class="anchor"></a><code><span><span class="keyword">val</span> connect_device :
<span><span><span>(<span>(<span class="xref-unresolved">Ipaddr</span>.t * int)</span> * <a href="#type-flow">flow</a>, <span>[&gt; <span>`Msg of string</span> ]</span>)</span> <span class="xref-unresolved">Stdlib</span>.result</span> <span class="xref-unresolved">Lwt</span>.t</span></span></code></div><div class="spec-doc"><p><code>connect t host ports</code> establishes a connection to <code>host</code> on <code>ports</code>, which may be a host name, or an IP address. The timeouts and delays are specified in nanoseconds, and are by default the values defined when constructing <code>t</code>.</p><ul class="at-tags"><li class="raises"><span class="at-tag">raises</span> <code>Failure</code> <p>if <code>ports</code> is the empty list.</p></li></ul></div></div></details></div><div class="odoc-spec"><div class="spec value anchored" id="val-connect_device"><a href="#val-connect_device" class="anchor"></a><code><span><span class="keyword">val</span> connect_device :
<span><span class="optlabel">?aaaa_timeout</span>:int64 <span class="arrow">&#45;&gt;</span></span>
<span><span class="optlabel">?connect_delay</span>:int64 <span class="arrow">&#45;&gt;</span></span>
<span><span class="optlabel">?connect_timeout</span>:int64 <span class="arrow">&#45;&gt;</span></span>
Expand Down
Loading

0 comments on commit e9c4f07

Please sign in to comment.