Fabcoin Core
0.16.2
P2P Digital Currency
|
Main API hub for interfacing with Web 3 components. More...
#include <WebThree.h>
Public Member Functions | |
WebThreeDirect (std::string const &_clientVersion, std::string const &_dbPath, eth::ChainParams const &_params, WithExisting _we=WithExisting::Trust, std::set< std::string > const &_interfaces={"eth","shh","bzz"}, p2p::NetworkPreferences const &_n=p2p::NetworkPreferences(), bytesConstRef _network=bytesConstRef(), bool _testing=false) | |
Constructor for private instance. More... | |
~WebThreeDirect () | |
Destructor. More... | |
eth::Client * | ethereum () const |
std::shared_ptr< shh::WhisperHost > | whisper () const |
std::string const & | clientVersion () const |
std::vector< p2p::PeerSessionInfo > | peers () override |
Get information on the current peer set. More... | |
size_t | peerCount () const override |
Same as peers().size(), but more efficient. More... | |
virtual void | addPeer (p2p::NodeSpec const &_node, p2p::PeerType _t) override |
Generalised peer addition. More... | |
virtual void | addNode (p2p::NodeID const &_node, bi::tcp::endpoint const &_hostEndpoint) override |
Add node to connect to. More... | |
void | addNode (p2p::NodeID const &_node, std::string const &_hostString) |
Add node to connect to. More... | |
void | addNode (bi::tcp::endpoint const &_endpoint) |
Add node to connect to. More... | |
void | addNode (std::string const &_hostString) |
Add node to connect to. More... | |
void | requirePeer (p2p::NodeID const &_node, bi::tcp::endpoint const &_endpoint) override |
Require connection to peer. More... | |
void | requirePeer (p2p::NodeID const &_node, std::string const &_hostString) |
Require connection to peer. More... | |
dev::bytes | saveNetwork () override |
Save peers. More... | |
void | setIdealPeerCount (size_t _n) override |
Sets the ideal number of peers. More... | |
void | setPeerStretch (size_t _n) |
Experimental. Sets ceiling for incoming connections to multiple of ideal peer count. More... | |
bool | haveNetwork () const override |
p2p::NetworkPreferences const & | networkPreferences () const override |
void | setNetworkPreferences (p2p::NetworkPreferences const &_n, bool _dropPeers=false) override |
p2p::NodeInfo | nodeInfo () const override |
Get information concerning this node. More... | |
p2p::NodeID | id () const override |
u256 | networkId () const override |
Get network id. More... | |
std::string | enode () const override |
Get enode string. More... | |
p2p::Peers | nodes () const override |
Gets the nodes. More... | |
void | startNetwork () override |
Start the network subsystem. More... | |
void | stopNetwork () override |
Stop the network subsystem. More... | |
bool | isNetworkStarted () const override |
Is network working? there may not be any peers yet. More... | |
Static Public Member Functions | |
static std::string | composeClientVersion (std::string const &_client) |
Private Attributes | |
std::string | m_clientVersion |
Our end-application client's name/version. More... | |
p2p::Host | m_net |
Should run in background and send us events when blocks found and allow us to send blocks as required. More... | |
std::unique_ptr< eth::Client > | m_ethereum |
Client for Ethereum ("eth") protocol. More... | |
std::weak_ptr< shh::WhisperHost > | m_whisper |
Client for Whisper ("shh") protocol. More... | |
Main API hub for interfacing with Web 3 components.
This doesn't do any local multiplexing, so you can only have one running on any given machine for the provided DB path.
Keeps a libp2p Host going (administering the work thread with m_workNet).
Encapsulates a bunch of P2P protocols (interfaces), each using the same underlying libp2p Host.
Provides a baseline for the multiplexed multi-protocol session class, WebThree.
Definition at line 119 of file WebThree.h.
WebThreeDirect::WebThreeDirect | ( | std::string const & | _clientVersion, |
std::string const & | _dbPath, | ||
eth::ChainParams const & | _params, | ||
WithExisting | _we = WithExisting::Trust , |
||
std::set< std::string > const & | _interfaces = {"eth", "shh", "bzz"} , |
||
p2p::NetworkPreferences const & | _n = p2p::NetworkPreferences() , |
||
bytesConstRef | _network = bytesConstRef() , |
||
bool | _testing = false |
||
) |
Constructor for private instance.
If there is already another process on the machine using _dbPath, then this will throw an exception. ethereum() may be safely static_cast()ed to a eth::Client*.
Definition at line 39 of file WebThree.cpp.
WebThreeDirect::~WebThreeDirect | ( | ) |
|
overridevirtual |
Add node to connect to.
Implements dev::NetworkFace.
Definition at line 145 of file WebThree.cpp.
|
inline |
Add node to connect to.
Definition at line 163 of file WebThree.h.
|
inline |
Add node to connect to.
Definition at line 166 of file WebThree.h.
|
inline |
Add node to connect to.
Definition at line 169 of file WebThree.h.
|
overridevirtual |
Generalised peer addition.
Implements dev::NetworkFace.
Definition at line 155 of file WebThree.cpp.
|
inline |
|
static |
Definition at line 93 of file WebThree.cpp.
|
inlineoverridevirtual |
Get enode string.
Implements dev::NetworkFace.
Definition at line 198 of file WebThree.h.
|
inline |
|
inlineoverridevirtual |
Implements dev::NetworkFace.
Definition at line 186 of file WebThree.h.
|
inlineoverridevirtual |
Implements dev::NetworkFace.
Definition at line 194 of file WebThree.h.
|
inlineoverridevirtual |
Is network working? there may not be any peers yet.
Implements dev::NetworkFace.
Definition at line 210 of file WebThree.h.
|
inlineoverridevirtual |
|
overridevirtual |
Implements dev::NetworkFace.
Definition at line 105 of file WebThree.cpp.
|
inlineoverridevirtual |
Get information concerning this node.
Implements dev::NetworkFace.
Definition at line 192 of file WebThree.h.
|
inlineoverridevirtual |
|
overridevirtual |
Same as peers().size(), but more efficient.
Implements dev::NetworkFace.
Definition at line 125 of file WebThree.cpp.
|
overridevirtual |
Get information on the current peer set.
Implements dev::NetworkFace.
Definition at line 120 of file WebThree.cpp.
|
overridevirtual |
Require connection to peer.
Implements dev::NetworkFace.
Definition at line 150 of file WebThree.cpp.
|
inline |
Require connection to peer.
Definition at line 175 of file WebThree.h.
|
overridevirtual |
Save peers.
Implements dev::NetworkFace.
Definition at line 140 of file WebThree.cpp.
|
overridevirtual |
Sets the ideal number of peers.
Implements dev::NetworkFace.
Definition at line 130 of file WebThree.cpp.
|
overridevirtual |
Implements dev::NetworkFace.
Definition at line 110 of file WebThree.cpp.
void WebThreeDirect::setPeerStretch | ( | size_t | _n | ) |
Experimental. Sets ceiling for incoming connections to multiple of ideal peer count.
Definition at line 135 of file WebThree.cpp.
|
inlineoverridevirtual |
Start the network subsystem.
Implements dev::NetworkFace.
Definition at line 204 of file WebThree.h.
|
inlineoverridevirtual |
Stop the network subsystem.
Implements dev::NetworkFace.
Definition at line 207 of file WebThree.h.
|
inline |
|
private |
Our end-application client's name/version.
Definition at line 213 of file WebThree.h.
|
private |
Client for Ethereum ("eth") protocol.
Definition at line 217 of file WebThree.h.
|
private |
Should run in background and send us events when blocks found and allow us to send blocks as required.
Definition at line 215 of file WebThree.h.
|
private |
Client for Whisper ("shh") protocol.
Definition at line 218 of file WebThree.h.