package tezos-p2p

  1. Overview
  2. Docs
type 'conn t
type 'conn point_info = 'conn t

Type of info associated to a point.

val compare : 'conn point_info -> 'conn point_info -> int
type reconnection_config = {
  1. factor : float;
  2. initial_delay : Tezos_base.Time.System.Span.t;
  3. disconnection_delay : Tezos_base.Time.System.Span.t;
  4. increase_cap : Tezos_base.Time.System.Span.t;
}
val default_reconnection_config : reconnection_config
val reconnection_config_encoding : reconnection_config Data_encoding.encoding
val create : ?trusted:bool -> ?expected_peer_id:Tezos_base.P2p_peer.Id.t -> Tezos_base.P2p_addr.t -> Tezos_base.P2p_addr.port -> 'conn point_info

create ~trusted addr port is a freshly minted point_info. If trusted is true, this point is considered trusted and will be treated as such. If expected_peer_id is specified, we check during a connection that the id received is the same as the expected_peer_id.

val trusted : 'conn point_info -> bool

trusted pi is true iff pi has is trusted, i.e. "whitelisted".

val known_public : 'conn point_info -> bool

Points can announce themselves as either public or private. Private points will not be advertised to other nodes.

val set_trusted : 'conn point_info -> unit
val unset_trusted : 'conn point_info -> unit
val get_expected_peer_id : 'conn point_info -> Tezos_base.P2p_peer.Id.t option

Return the expected_peer_id given to create.

val last_failed_connection : 'conn point_info -> Tezos_base.Time.System.t option
val last_rejected_connection : 'conn point_info -> (Tezos_base.P2p_peer.Id.t * Tezos_base.Time.System.t) option
val last_established_connection : 'conn point_info -> (Tezos_base.P2p_peer.Id.t * Tezos_base.Time.System.t) option
val last_disconnection : 'conn point_info -> (Tezos_base.P2p_peer.Id.t * Tezos_base.Time.System.t) option

last_seen pi is the most recent of:

* last established connection * last rejected connection * last disconnection

val last_miss : 'conn point_info -> Tezos_base.Time.System.t option

last_miss pi is the most recent of:

* last failed connection * last rejected connection * last disconnection

val reset_reconnection_delay : 'conn point_info -> unit
val can_reconnect : now:Tezos_base.Time.System.t -> 'conn point_info -> bool
val reconnection_time : 'conn point_info -> Tezos_base.Time.System.t option
val log_incoming_rejection : timestamp:Tezos_base.Time.System.t -> 'conn point_info -> Tezos_base.P2p_peer.Id.t -> unit
val events : 'conn t -> Tezos_base.P2p_point.Pool_event.t list
OCaml

Innovation. Community. Security.