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.TzPervasives.P2p_peer.Id.t -> ('msg, 'peer, 'conn) info option
val get_peer_metadata : ('msg, 'peer, 'conn) t -> Tezos_base.TzPervasives.P2p_peer.Id.t -> 'peer
val set_peer_metadata : ('msg, 'peer, 'conn) t -> Tezos_base.TzPervasives.P2p_peer.Id.t -> 'peer -> unit
val get_score : ('msg, 'peer, 'conn) t -> Tezos_base.TzPervasives.P2p_peer.Id.t -> float
val fold_known : ('msg, 'peer, 'conn) t -> init:'a -> f: (Tezos_base.TzPervasives.P2p_peer.Id.t -> ('msg, 'peer, 'conn) info -> 'a -> 'a) -> 'a

fold_known pool ~init ~f computes (f iN pN ... (f i1 p1 init)...) where id1 ... idN are the ids of every known peers and p1 ... pN the associated peers info.

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

iter_known f pool applies f to all known peers of pool.

val fold_connected : ('msg, 'peer, 'conn) t -> init:'a -> f: (Tezos_base.TzPervasives.P2p_peer.Id.t -> ('msg, 'peer, 'conn) info -> 'a -> 'a) -> 'a

fold_connected pool ~init ~f computes (f iN pN ... (f i1 p1 init)...) where id1 ... idN are the ids of every connected peers and p1 ... pN the associated peers info.

val add_connected : ('msg, 'peer, 'conn) t -> Tezos_base.TzPervasives.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.TzPervasives.P2p_peer.Id.t -> unit
val ban : ('msg, 'peer, 'conn) t -> Tezos_base.TzPervasives.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.TzPervasives.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.TzPervasives.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.TzPervasives.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.TzPervasives.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.TzPervasives.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.

val get_greylisted_list : ('msg, 'peer, 'conn) t -> Tezos_base.TzPervasives.P2p_peer.Id.t list

get_greylisted_list t returns the list of all the greylisted peers