Documentation ¶
Index ¶
- Variables
- func ConstructMessage(content []byte) []byte
- func StringsToAddrs(addrStrings []string) (maddrs []ma.Multiaddr, err error)
- type AddrList
- type Host
- type HostV2
- func (host *HostV2) AddPeer(p *Peer) error
- func (host *HostV2) AllTopics() []*libp2p_pubsub.Topic
- func (host *HostV2) ConnectHostPeer(peer Peer) error
- func (host *HostV2) GetID() libp2p_peer.ID
- func (host *HostV2) GetP2PHost() libp2p_host.Host
- func (host *HostV2) GetPeerCount() int
- func (host *HostV2) GetSelfPeer() Peer
- func (host *HostV2) Peerstore() libp2p_peerstore.Peerstore
- func (host *HostV2) SendMessageToGroups(groups []nodeconfig.GroupID, msg []byte) (err error)
- type Peer
Constants ¶
This section is empty.
Variables ¶
var DefaultBootNodeAddrStrings = []string{
"/ip4/127.0.0.1/tcp/19876/p2p/Qmc1V6W7BwX8Ugb42Ti8RnXF1rY5PF7nnZ6bKBryCgi6cv",
}
DefaultBootNodeAddrStrings is a list of Harmony bootnodes address. Used to find other peers in the network.
Functions ¶
func ConstructMessage ¶ added in v1.3.8
ConstructMessage constructs the p2p message as [messageType, contentSize, content]
Types ¶
type AddrList ¶ added in v1.3.8
AddrList is a list of multiaddress
var BootNodes AddrList
BootNodes is a list of boot nodes. It is populated either from default or from user CLI input.
type Host ¶
type Host interface { GetSelfPeer() Peer AddPeer(*Peer) error GetID() libp2p_peer.ID GetP2PHost() libp2p_host.Host GetPeerCount() int ConnectHostPeer(Peer) error // SendMessageToGroups sends a message to one or more multicast groups. SendMessageToGroups(groups []nodeconfig.GroupID, msg []byte) error AllTopics() []*libp2p_pubsub.Topic }
Host is the client + server in p2p network.
type HostV2 ¶ added in v1.3.8
type HostV2 struct {
// contains filtered or unexported fields
}
HostV2 is the version 2 p2p host
func (*HostV2) AllTopics ¶ added in v1.3.8
func (host *HostV2) AllTopics() []*libp2p_pubsub.Topic
AllTopics ..
func (*HostV2) ConnectHostPeer ¶ added in v1.3.8
ConnectHostPeer connects to peer host
func (*HostV2) GetID ¶ added in v1.3.8
func (host *HostV2) GetID() libp2p_peer.ID
GetID returns ID.Pretty
func (*HostV2) GetP2PHost ¶ added in v1.3.8
func (host *HostV2) GetP2PHost() libp2p_host.Host
GetP2PHost returns the p2p.Host
func (*HostV2) GetPeerCount ¶ added in v1.3.8
GetPeerCount ...
func (*HostV2) GetSelfPeer ¶ added in v1.3.8
GetSelfPeer gets self peer
func (*HostV2) Peerstore ¶ added in v1.3.8
func (host *HostV2) Peerstore() libp2p_peerstore.Peerstore
Peerstore returns the peer store
func (*HostV2) SendMessageToGroups ¶ added in v1.3.8
func (host *HostV2) SendMessageToGroups(groups []nodeconfig.GroupID, msg []byte) (err error)
SendMessageToGroups sends a message to one or more multicast groups. It returns a nil error if and only if it has succeeded to schedule the given message for sending.
type Peer ¶
type Peer struct { IP string // IP address of the peer Port string // Port number of the peer ConsensusPubKey *bls.PublicKey // Public key of the peer, used for consensus signing Addrs []ma.Multiaddr // MultiAddress of the peer PeerID libp2p_peer.ID // PeerID, the pubkey for communication }
Peer is the object for a p2p peer (node)