Peer To Peer
Currently only monitoring the p2p status is possible, not maipulating it.
- Procedure ocp.p2p.id()
Get the id of the node
- Return
id (NodeID) – The id of the node
- Procedure ocp.p2p.adresses(shortened)
Get all the adresses the node is reachable with. This includes only adresses, the node knows about Hence it can change over lifetime, if we learn about new ones, for example after connecting successfully to a public node, or after connecting locally to annother node.
- Parameters
shortened (bool) – The listed adresses do not include the NodeID if True
- Return
adresses (list[str]) – List of p2p IP adresses the node is reachable with
- Procedure ocp.p2p.peers()
Return all peers we are currently connected to
- Return
peers (list[NodeID]) – The list of all connected peers
- Procedure ocp.p2p.reachability()
Returns the reachability status. This indicates, if we are reachable by other nodes from outside (reachabilit = public) or if they cannot connect to us (reachability = private) Initially the eachability is “unknown”, and only after the node connected to a bootstrap node it can be checked and updated.
- Return
reachability (str) – “Public”, “Private” or “Unknown”
- Event ocp.p2p.ocp.p2p.peerConnected
Emitted when a peer connected to this node.
- Arguments
peer (NodeID) – The peer that connected
- Event ocp.p2p.peerDisconnected
Emitted when a peer disconnected from this node.
- Arguments
peer (NodeID) – The peer that disconnected
- Event ocp.p2p.addressesChanged
Emitted when the known adresses of the node change.
- Arguments
addrs (list[str]) – All known p2p adresses of the node
- Event ocp.p2p.reachabilityChanged
Emited when the reacahbility status changed. It is initially always unknown, and any update to it will be published.
- Arguments
reachability (str) – New reachability status, “Public”, “Private” or “Unknown”