Upsycle_router.Commons
Contains shared types and values which are used throughout the application.
type 'a rresult = ('a, result_msg) Stdlib.result
type 'a of_yaml = Yaml.value -> 'a rresult
These are the base types we use for private and public keys; no need to try and hide the implementation.
Used for choosing the Blake2 hash function for calculating message IDs.
When the message router receives a JOIN request whose src
field doesn't match the actual public key of the peer, it needs to decide which one to actually add to the group. By default this is set to `Src
in the configurations, but `Peerkey can be useful for testing or experimenting.
Configures whether or not to dump the contents of every message received by the message router to the console.
type multicast_table =
(multicast_group_pubkey, multicast_subscriber BatSet.t) BatMap.t
The functions in T
are just function versions of the constructors of various types, which provides a convenient way of constructing types in many situations.
module T : sig ... end
module Pp : sig ... end
module Encode : sig ... end
module Decode : sig ... end
module Crypto : sig ... end
module Yaml : sig ... end
module Mk : sig ... end
module Acc : sig ... end
Provides handlers for the keys 'q', '\n', and an unknown key press, to be used in the key thread.
Returns a random integer for use in the `ttl` field.
mk_random_ttl `Short
produces an integer in the range [3, 10].
mk_random_ttl `Medium
produces an integer in the range [10, 30].
Returns a random integer representing minutes elapsed since 2020-01-01 00:00 UTC, for use in the `expiry` field.
Returns a random integer in the range [0, 19], for use in the `revision` field.
val to_yaml_noop : 'a Util_yaml.to_yaml
ppx_deriving_yaml
requires both an x_to_yaml
and x_of_yaml
function for a type x
in order to be able produce derivations for types which include x
. However the 'of_yaml' variant is never used in this library so there's no sense in writing it; this function can be provided instead to satisfy the requirements.
val error_msg : string -> string rresult
Convenience for generating Error (`Msg s)
from a string s
.
val pubkey_of_multicast_group : multicast_group -> pubkey
val string_list_of_command : command -> string list