jon.recoil.org

Module Eio_mock.NetSource

Mock Eio.Net networks and sockets.

type t = [ `Generic | `Mock ] Eio.Net.ty Eio.Std.r
type listening_socket = [ `Generic | `Mock ] Eio.Net.listening_socket_ty Eio.Std.r
val make : string -> Eio_mock.Net.t

make label is a new mock network.

on_connect t actions configures what to do when a client tries to connect somewhere.

on_listen t actions configures what to do when a server starts listening for incoming connections.

on_datagram_socket t actions configures how to create datagram sockets.

val on_getaddrinfo : Eio_mock.Net.t -> Eio.Net.Sockaddr.t list Eio_mock.Handler.actions -> unit
val on_getnameinfo : Eio_mock.Net.t -> (string * string) Eio_mock.Handler.actions -> unit
val listening_socket : ?listening_addr:Eio.Net.Sockaddr.stream -> string -> Eio_mock.Net.listening_socket

listening_socket label can be configured to provide mock connections.

If listening_addr is not provided, a dummy value will be reported.

on_accept socket actions configures how to respond when the server calls "accept".