Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type EthNode ¶
type EthNode interface { ContractBackend() bind.ContractBackend // Kind returns the kind of node this is. Kind() NodeKind // Enode returns this node's enode://... Enode(ctx context.Context) (string, error) // AddTrustedPeer adds a nodeID to a set of nodes that can always connect, even // if the maximum number of connections is reached. AddTrustedPeer(ctx context.Context, nodeID string) error // RemoveTrustedPeer removes a nodeID from the trusted node set. RemoveTrustedPeer(ctx context.Context, nodeID string) error // ConnectPeer prompts a connection to the given nodeURI. ConnectPeer(ctx context.Context, nodeURI string) error // DisconnectPeer disconnects from the given nodeID, if connected. DisconnectPeer(ctx context.Context, nodeID string) error // Peers returns the list of connected peers Peers(ctx context.Context) ([]PeerInfo, error) // BlockNumber returns the current sync'd block number. BlockNumber(ctx context.Context) (uint64, error) }
EthNode is the normalized interface between different kinds of nodes.
type NetworkID ¶ added in v0.2.2
type NetworkID int
type NodeKind ¶
type NodeKind int
NodeKind represents the different kinds of node implementations we know about.
type PeerInfo ¶
type PeerInfo struct { ID string `json:"id"` // Unique node identifier (also the encryption pubkey) Name string `json:"name"` // Name of the node, including client type, version, OS, custom data }
PeerInfo stores the node ID and client metadata about a peer.
type UserAgent ¶ added in v0.2.2
type UserAgent struct { Version string // Result of web3_clientVersion EthProtocol string // Result of eth_protocolVersion // Parsed/derived values Kind NodeKind // Node implementation Network NetworkID // Network ID IsFullNode bool // Is this a full node? (or a light client?) }
UserAgent is the metadata about node client.
func DetectClient ¶
DetectClient queries the RPC API to determine which kind of node is running.
func ParseUserAgent ¶ added in v0.2.2
ParseUserAgent takes string values as output from the web3 RPC for web3_clientVersion, eth_protocolVersion, and net_version. It returns a parsed user agent metadata.
Click to show internal directories.
Click to hide internal directories.