14#include "core/bytes.h"
43 virtual std::vector<PeerInfo>
peers()
const = 0;
A dialable transport address (ip + port).
virtual void on(MessageType type, MessageHandler handler)=0
std::function< void(const Address &)> DialFailedHandler
virtual const PeerId & local_id() const =0
virtual void connect(const Address &address)=0
dial a discovered peer
virtual void broadcast(MessageType type, ByteView payload)=0
std::function< void(const Peer &, ByteView)> MessageHandler
virtual void send(const PeerId &to, MessageType type, ByteView payload)=0
virtual void on_peer_disconnected(PeerDisconnectHandler handler)=0
virtual ~PeerNetwork()=default
virtual void on_peer_connected(PeerEventHandler handler)=0
virtual void on_dial_failed(DialFailedHandler handler)=0
virtual std::vector< PeerInfo > peers() const =0
snapshot incl. dialable addresses
virtual uint16_t listen_port() const =0
our advertised TCP port
std::function< void(const Peer &)> PeerEventHandler
virtual std::vector< PeerId > connected_peers() const =0
std::function< void(const PeerId &)> PeerDisconnectHandler
A pluggable network subsystem.
virtual ~Subsystem()=default
virtual void attach(NodeContext &ctx)=0
Two-level wire framing: outer length-prefixed blocks, inner messages.
MessageType
Inner-message kind. Application traffic uses App, addressed by channel.
Self-certifying peer identity.
Addressing/metadata for a peer — the shareable, persistable identity.