package caqti

  1. Overview
  2. Docs
Module type
Class type
module Sockaddr : sig ... end
val getaddrinfo : stdenv:stdenv -> [ `host ] Domain_name.t -> int -> (Sockaddr.t list, [> `Msg of string ]) Stdlib.result Fiber.t

This should be a specialized version of getaddrinfo, which only returns entries which is expected to work with the corresponding connect on the platform implementing this interface. In particular:

  • The family can be IPv4 or IPv6, where supported, and this must be encoded in the Sockaddr.t.
  • The socket type is restricted to STREAM.
  • The protocol is assumed to be selected automatically from address family, given the socket type restriction.

All returned values are TCP destinations. If a distinction can be made, an empty list indicates that the address has no DNS entries, while an error return indicates that an appropriate DNS server could not be queried.

val convert_io_exception : exn -> Caqti_error.msg option

If the read and write operations in Socket raise exceptions other than End_of_file and Failure, this function is used to intercept them.

module Socket : SOCKET_OPS with type 'a fiber := 'a Fiber.t

A socket with input and output channels and dedicated IO functions. This bundling is done to support the various APIs involved for networking and StartTLS.

type tcp_flow
type tls_flow
val connect_tcp : sw:Switch.t -> stdenv:stdenv -> Sockaddr.t -> (Socket.t, Caqti_error.msg) Stdlib.result Fiber.t
val tcp_flow_of_socket : Socket.t -> tcp_flow option
val socket_of_tls_flow : sw:Switch.t -> tls_flow -> Socket.t
module type TLS_PROVIDER = TLS_PROVIDER with type 'a fiber := 'a Fiber.t and type tcp_flow := tcp_flow and type tls_flow := tls_flow
val register_tls_provider : (module TLS_PROVIDER) -> unit
val tls_providers : Caqti_connect_config.t -> (module TLS_PROVIDER) list