package tiny_libs
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>
From-scratch libraries for teaching: graphics, audio, compression, crypto, networking and more
Install
dune-project
Dependency
Authors
Maintainers
Sources
0.3.6.tar.gz
md5=7c636383d146d30ac6f2fa234a6253c8
sha512=c79f3823c5f8f57e5038eb640d487c61168b84aa07c61999d6622ef9fd0c890e2b03b4c6a7cdbbe9352a49e25dda00ac7bb14693cee8e3d7beeed251351a2af0
doc/src/tiny_libs.networking_protocols/Transport.ml.html
Source file Transport.ml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32(* Claude Code * * Copyright (C) 2026 Yoann Padioleau * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public License * (LGPL) as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. *) (* See Transport.mli *) type t = { send : string -> unit; receive : unit -> string list; status : unit -> string; player : unit -> int option } type role = | Host of { bind : string; port : int } | Join of { host : string; port : int } | Relay of { host : string; port : int } let installed : (Cap.network -> role -> (t, string) result) ref = ref (fun _ _ -> Error "no network on this platform") let set_connect f = installed := f let connect (caps : < Cap.network ; .. >) (role : role) : (t, string) result = !installed (caps :> Cap.network) role let tunnel_installed : (Cap.exec -> host:string -> port:int -> (t, string) result) ref = ref (fun _ ~host:_ ~port:_ -> Error "no TLS here: its tunnel runs a program, which a browser cannot") let set_tunnel f = tunnel_installed := f let tunnel (caps : < Cap.exec ; .. >) ~(host : string) ~(port : int) : (t, string) result = !tunnel_installed (caps :> Cap.exec) ~host ~port let tls_installed : (Cap.network -> host:string -> port:int -> (t, string) result) ref = ref (fun _ ~host:_ ~port:_ -> Error "no TLS on this platform") let set_tls f = tls_installed := f let tls (caps : < Cap.network ; .. >) ~(host : string) ~(port : int) : (t, string) result = !tls_installed (caps :> Cap.network) ~host ~port
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>