package conduit-lwt-unix
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=2510372ed98c7e0446d788317a435f752d900d72df0fbe4c353f5e5bfb9d1dd2
sha512=3e25b754c84dd603acbb4d810b532c3cfb273808b9bf9a17890e40b79e65529d17cd66d613a447cb2a7f51f0522f17d46ab0ade5c79cb2a3c8565efd484238ae
doc/conduit-lwt-unix/Conduit_lwt_unix/index.html
Module Conduit_lwt_unix
Connection establishment using the Lwt_unix library
Core types
Configuration fragment for a TLS client connecting to a remote endpoint
val sexp_of_client_tls_config : client_tls_config -> Ppx_sexp_conv_lib.Sexp.tval client_tls_config_of_sexp : Ppx_sexp_conv_lib.Sexp.t -> client_tls_configtype client = [ | `TLS of client_tls_config| `TLS_native of client_tls_config(*Force use of native OCaml TLS stack to connect.
*)| `OpenSSL of client_tls_config(*Force use of Lwt OpenSSL bindings to connect.
*)| `TCP of [ `IP of Ipaddr.t ] * [ `Port of int ](*Use TCP to connect to the given
*)ip,porttuple.| `Unix_domain_socket of [ `File of string ](*Use UNIX domain sockets to connect to a socket on the
*)path.| `Vchan_direct of [ `Domid of int ] * [ `Port of string ](*Connect to the remote VM on the
*)domid,porttuple.| `Vchan_domain_socket of [ `Domain_name of string ] * [ `Port of string ](*Use the Vchan name resolution to connect
*)
]Set of supported client connections that are supported by this module:
`TLS (`Hostname host, `IP ip, `Port port): Use OCaml-TLS or OpenSSL (depending on CONDUIT_TLS) to connect to the givenhost,ip,porttuple via TCP.`TLS_native _: Force use of native OCaml TLS stack to connect.`OpenSSL _: Force use of Lwt OpenSSL bindings to connect.`TCP (`IP ip, `Port port): Use TCP to connect to the givenip,porttuple.`Unix_domain_socket (`File path): Use UNIX domain sockets to connect to a socket on thepath.`Vchan_direct (`Domid domid, `Port port): Connect to the remote VM on thedomid,porttuple.`Vchan_domain_socket (`Domain_name domain, `Port port_name): Use the Vchan name resolution to connect.
val sexp_of_client : client -> Ppx_sexp_conv_lib.Sexp.tval client_of_sexp : Ppx_sexp_conv_lib.Sexp.t -> clientval __client_of_sexp__ : Ppx_sexp_conv_lib.Sexp.t -> clienttype server_tls_config =
[ `Crt_file_path of string ]
* [ `Key_file_path of string ]
* [ `Password of bool -> string | `No_password ]
* [ `Port of int ]Configuration fragment for a listening TLS server
val sexp_of_server_tls_config : server_tls_config -> Ppx_sexp_conv_lib.Sexp.tval server_tls_config_of_sexp : Ppx_sexp_conv_lib.Sexp.t -> server_tls_configSet of ways to create TCP servers
`Port port: Create a socket listening to provided port.`Socket file_descr: Use the provided file descriptor to create a server.
val sexp_of_tcp_config : tcp_config -> Ppx_sexp_conv_lib.Sexp.tval tcp_config_of_sexp : Ppx_sexp_conv_lib.Sexp.t -> tcp_configval __tcp_config_of_sexp__ : Ppx_sexp_conv_lib.Sexp.t -> tcp_configtype server = [ | `TLS of server_tls_config| `OpenSSL of server_tls_config| `TLS_native of server_tls_config| `TCP of tcp_config| `Unix_domain_socket of [ `File of string ]| `Vchan_direct of int * string| `Vchan_domain_socket of string * string| `Launchd of string
]Set of supported listening mechanisms that are supported by this module.
`TLS server_tls_config: Use OCaml-TLS or OpenSSL (depending on CONDUIT_TLS) to connect to the givenhost,ip,porttuple via TCP.`TLS_native _: Force use of native OCaml TLS stack to connect.`OpenSSL _: Force use of Lwt OpenSSL bindings to connect.`TCP (`Port port): Listen on the specified TCPv4 port.`Unix_domain_socket (`File path): Use UNIX domain sockets to listen on the path.`Vchan_direct (domid, port): Listen for the remote VM on thedomid,porttuple.`Vchan_domain_socket (domain, port_name): Use the Vchan name resolution to listen`Listening_socket fd: Use the socket given, useful for inherited systemd sockets.`Launchd name: uses MacOS X launchd to start the service, via the name of theSocketselement within the service description plist file. See the ocaml-launchd documentation for more.
val sexp_of_server : server -> Ppx_sexp_conv_lib.Sexp.tval server_of_sexp : Ppx_sexp_conv_lib.Sexp.t -> serverval __server_of_sexp__ : Ppx_sexp_conv_lib.Sexp.t -> servertype ic = Lwt_io.input_channeltype oc = Lwt_io.output_channeltype tcp_flow = private {fd : Lwt_unix.file_descr Sexplib.Conv.sexp_opaque;ip : Ipaddr.t;port : int;
}tcp_flow contains the state of a single TCP connection.
val sexp_of_tcp_flow : tcp_flow -> Ppx_sexp_conv_lib.Sexp.tdomain_flow contains the state of a single Unix domain socket connection.
val sexp_of_domain_flow : domain_flow -> Ppx_sexp_conv_lib.Sexp.tvchan_flow contains the state of a single Vchan shared memory connection.
val sexp_of_vchan_flow : vchan_flow -> Ppx_sexp_conv_lib.Sexp.tA flow contains the state of a single connection, over a specific transport method.
val sexp_of_flow : flow -> Ppx_sexp_conv_lib.Sexp.ttype tls_own_key = [ | `None| `TLS of [ `Crt_file_path of string ] * [ `Key_file_path of string ] * [ `Password of bool -> string | `No_password ]
]Type describing where to locate a PEM key in the filesystem
val sexp_of_tls_own_key : tls_own_key -> Ppx_sexp_conv_lib.Sexp.tval tls_own_key_of_sexp : Ppx_sexp_conv_lib.Sexp.t -> tls_own_keyval __tls_own_key_of_sexp__ : Ppx_sexp_conv_lib.Sexp.t -> tls_own_keyval sexp_of_ctx : ctx -> Ppx_sexp_conv_lib.Sexp.tConnection and listening
val default_ctx : ctxDefault context that listens on all source addresses with no TLS certificate associated with the Conduit
val init :
?src:string ->
?tls_own_key:tls_own_key ->
?tls_server_key:tls_own_key ->
unit ->
ctx ioinit ?src ?tls_own_key () will initialize a Unix conduit that binds to the src interface if specified. If TLS server connections are used, then tls_server_key must contain a valid certificate to be used to advertise a TLS connection
connect ~ctx client establishes an outgoing connection via the ctx context to the endpoint described by client
val serve :
?backlog:int ->
?timeout:int ->
?stop:unit io ->
on_exn:(exn -> unit) ->
ctx:ctx ->
mode:server ->
(flow -> ic -> oc -> unit io) ->
unit ioserve ?backlog ?timeout ?stop ~on_exn ~ctx ~mode fn establishes a listening connection of type mode, using the ctx context. The stop thread will terminate the server if it ever becomes determined. Every connection will be served in a new lightweight thread that is invoked via the fn callback. The fn callback is passed the flow representing the client connection and the associated input ic and output oc channels. If the callback raises an exception, it is passed to on_exn.
set_max_active nconn sets the maximum number of active connections accepted. When the limit is hit accept blocks until another server connection is closed.
val endp_of_flow : flow -> Conduit.endpendp_of_flow flow retrieves the original Conduit.endp from the established flow
endp_to_client ~ctx endp converts an endp into a a concrete connection mechanism of type client
endp_to_server ~ctx endp converts an endp into a a concrete connection mechanism of type server