package tezos-p2p

  1. Overview
  2. Docs
type ('msg, 'peer, 'conn) info = ('msg, 'peer, 'conn) P2p_conn.t P2p_point_state.Info.t
val info : ('msg, 'peer, 'conn) t -> Tezos_base.TzPervasives.P2p_point.Id.t -> ('msg, 'peer, 'conn) info option
val fold_known : ('msg, 'peer, 'conn) t -> init:'a -> f: (Tezos_base.TzPervasives.P2p_point.Id.t -> ('msg, 'peer, 'conn) P2p_conn.t P2p_point_state.Info.t -> '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 points and p1 ... pN the associated points info.

val iter_known : (Tezos_base.TzPervasives.P2p_point.Id.t -> ('msg, 'peer, 'conn) P2p_conn.t P2p_point_state.Info.t -> unit) -> ('msg, 'peer, 'conn) t -> unit

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

val fold_connected : ('msg, 'peer, 'conn) t -> init:'a -> f: (Tezos_base.TzPervasives.P2p_point.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 connected points and p1 ... pN the associated points info.

val add_connected : ('msg, 'peer, 'conn) t -> Tezos_base.TzPervasives.P2p_point.Id.t -> ('msg, 'peer, 'conn) P2p_conn.t P2p_point_state.Info.t -> unit
val remove_connected : ('msg, 'peer, 'conn) t -> 'd P2p_point_state.Info.t -> unit
val ban : ('msg, 'peer, 'conn) t -> ?ban_peers:bool -> Tezos_base.TzPervasives.P2p_point.Id.t -> unit Lwt.t

ban t point_id marks the address of this point_id as blacklisted. It disconnects and bans all connections to this address. If ban_peers is false the associated peers are disconnected but not banned. The point_id port is ignored.

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

unban t point_id removes this point address from the black list. and unban all associated peers. The point_id port is ignored.

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

banned t point_id returns true if the point addr is in the black list. This point_id's port is ignored.

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

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

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

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

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

untrust t point_id sets the point info peer info for this point to not trusted. Does nothing if point isn't known.

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

get_greylisted_list t if greylisted_list_not_reliable_since t returns None, returns the list of currently greylisted IPs.

val greylisted_list_not_reliable_since : ('msg, 'peer, 'conn) t -> Tezos_base.TzPervasives.Time.System.t option