Cap'n Proto is a capability-based RPC system with bindings for many languages
Library capnp-rpc-unix
module Location : sig ... end
include Capnp_rpc_lwt.S.NETWORK with type t = unit and type Address.t = Location.t * Capnp_rpc_lwt.Auth.Digest.t
type t = unit
val connect : t -> switch:Lwt_switch.t -> secret_key:Capnp_rpc_lwt.Auth.Secret_key.t Lazy.t -> Address.t -> ( Capnp_rpc_lwt.Endpoint.t, [> `Msg of string ] ) result Lwt.t

connect t ~switch ~secret_key address connects to address, proves ownership of secret_key (if TLS is being used), and returns the resulting endpoint. Returns an error if no connection can be established or the target fails to authenticate itself. If switch is turned off, the connection should be terminated.

val accept_connection : switch:Lwt_switch.t -> secret_key:Capnp_rpc_lwt.Auth.Secret_key.t option -> Unix_flow.flow -> ( Capnp_rpc_lwt.Endpoint.t, [> `Msg of string ] ) result Lwt.t

accept_connection ~switch ~secret_key flow is a new endpoint for flow. If secret_key is not None, it is used to perform a TLS server-side handshake. Otherwise, the connection is not encrypted.