package tezos-p2p

  1. Overview
  2. Docs
type ('msg, 'peer, 'conn) info = (('msg, 'peer, 'conn) P2p_conn.t, 'peer, 'conn) P2p_peer_state.Info.t
val info : ('msg, 'peer, 'conn) t -> Tezos_base.P2p_peer.Id.t -> ('msg, 'peer, 'conn) info option
val get_peer_metadata : ('msg, 'peer, 'conn) t -> Tezos_base.P2p_peer.Id.t -> 'peer
val set_peer_metadata : ('msg, 'peer, 'conn) t -> Tezos_base.P2p_peer.Id.t -> 'peer -> unit
val get_score : ('msg, 'peer, 'conn) t -> Tezos_base.P2p_peer.Id.t -> float
val fold_known : ('msg, 'peer, 'conn) t -> init:'a -> f:(Tezos_base.P2p_peer.Id.t -> ('msg, 'peer, 'conn) info -> 'a -> 'a) -> 'a
val fold_connected : ('msg, 'peer, 'conn) t -> init:'a -> f:(Tezos_base.P2p_peer.Id.t -> ('msg, 'peer, 'conn) info -> 'a -> 'a) -> 'a
val add_connected : ('msg, 'peer, 'conn) t -> Tezos_base.P2p_peer.Id.t -> (('msg, 'peer, 'conn) P2p_conn.t, 'peer, 'conn) P2p_peer_state.Info.t -> unit
val remove_connected : ('msg, 'peer, 'conn) t -> Tezos_base.P2p_peer.Id.t -> unit
val ban : ('msg, 'peer, 'conn) t -> Tezos_base.P2p_peer.Id.t -> unit Lwt.t

ban t peer_id blacklists this peer_id and terminates connection (if any).

val unban : ('msg, 'peer, 'conn) t -> Tezos_base.P2p_peer.Id.t -> unit

unban t peer_id removes this peer_id from the black list.

val banned : ('msg, 'peer, 'conn) t -> Tezos_base.P2p_peer.Id.t -> bool

banned t peer_id returns true if the peer is in the black list.

val get_trusted : ('msg, 'peer, 'conn) t -> Tezos_base.P2p_peer.Id.t -> bool

get_trusted t peer_id returns false if this peer isn't known. Otherwise it calls trusted for this peer info.

val trust : ('msg, 'peer, 'conn) t -> Tezos_base.P2p_peer.Id.t -> unit

trust t peer_id sets the peer info for this peer to trusted, and unban it. The peer is registered first if not known (see register_peer).

val untrust : ('msg, 'peer, 'conn) t -> Tezos_base.P2p_peer.Id.t -> unit

untrust t peer_id set the peer info for this peer to not trusted. Does nothing if this peer isn't known.

OCaml

Innovation. Community. Security.