Documentation ¶
Index ¶
- func New(cfg *config.Configure) (pbftnet.SwitcherI, error)
- func PrivateKey2PeerID(pri *ecdsa.PrivateKey) (string, error)
- func PublicKey2PeerID(pub *ecdsa.PublicKey) (string, error)
- func PublicString2PeerID(key string) (string, error)
- type P2PNetWork
- func (p2p *P2PNetWork) Broadcast(modelID string, msg *pbftnet.BroadcastMsg) error
- func (p2p *P2PNetWork) BroadcastExceptPeer(modelID string, msg *pbftnet.BroadcastMsg, p *pbftnet.Peer) error
- func (p2p *P2PNetWork) BroadcastToPeer(modelID string, msg *pbftnet.BroadcastMsg, p *pbftnet.Peer) error
- func (p2p *P2PNetWork) NodeDiscovery()
- func (p2p *P2PNetWork) Peers() ([]*pbftnet.Peer, error)
- func (p2p *P2PNetWork) RegisterOnReceive(modelID string, callBack pbftnet.OnReceive) error
- func (p2p *P2PNetWork) RemovePeer(p *pbftnet.Peer) error
- func (p2p *P2PNetWork) SpecialNodeConnect()
- func (p2p *P2PNetWork) Start() error
- type P2PStream
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func PrivateKey2PeerID ¶
func PrivateKey2PeerID(pri *ecdsa.PrivateKey) (string, error)
func PublicString2PeerID ¶
Types ¶
type P2PNetWork ¶
func (*P2PNetWork) Broadcast ¶
func (p2p *P2PNetWork) Broadcast(modelID string, msg *pbftnet.BroadcastMsg) error
实现switcher接口 向所有的节点广播消息
func (*P2PNetWork) BroadcastExceptPeer ¶
func (p2p *P2PNetWork) BroadcastExceptPeer(modelID string, msg *pbftnet.BroadcastMsg, p *pbftnet.Peer) error
BroadcastExceptPeer 除了某个节点 向任意节点广播消息
func (*P2PNetWork) BroadcastToPeer ¶
func (p2p *P2PNetWork) BroadcastToPeer(modelID string, msg *pbftnet.BroadcastMsg, p *pbftnet.Peer) error
广播到指定的peer
func (*P2PNetWork) NodeDiscovery ¶
func (p2p *P2PNetWork) NodeDiscovery()
func (*P2PNetWork) RegisterOnReceive ¶
func (p2p *P2PNetWork) RegisterOnReceive(modelID string, callBack pbftnet.OnReceive) error
func (*P2PNetWork) SpecialNodeConnect ¶
func (p2p *P2PNetWork) SpecialNodeConnect()
func (*P2PNetWork) Start ¶
func (p2p *P2PNetWork) Start() error
Click to show internal directories.
Click to hide internal directories.