Documentation ¶
Overview ¶
Package tcp provides a TCP based implementation of the peering overlay network.
Index ¶
- func SendMsgToPeers(msg *peering.PeerMessage, ts int64, peers ...*peer) uint16
- type NetImpl
- func (n *NetImpl) Attach(chainID *coretypes.ChainID, callback func(recv *peering.RecvEvent)) interface{}
- func (n *NetImpl) Await(timeout time.Duration) error
- func (n *NetImpl) Close()
- func (n *NetImpl) Detach(attachID interface{})
- func (n *NetImpl) Group(peerNetIDs []string) (peering.GroupProvider, error)
- func (n *NetImpl) IsAlive() bool
- func (n *NetImpl) NetID() string
- func (n *NetImpl) PeerByNetID(peerNetID string) (peering.PeerSender, error)
- func (n *NetImpl) PeerByPubKey(peerPub kyber.Point) (peering.PeerSender, error)
- func (n *NetImpl) PeerStatus() []peering.PeerStatusProvider
- func (n *NetImpl) PubKey() kyber.Point
- func (n *NetImpl) Run(shutdownSignal <-chan struct{})
- func (n *NetImpl) Self() peering.PeerSender
- func (n *NetImpl) SendMsg(msg *peering.PeerMessage)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SendMsgToPeers ¶
func SendMsgToPeers(msg *peering.PeerMessage, ts int64, peers ...*peer) uint16
SendMsgToPeers sends same msg to all peers in the slice which are not nil with the same timestamp return number of successfully sent messages and timestamp
Types ¶
type NetImpl ¶
type NetImpl struct {
// contains filtered or unexported fields
}
NetImpl implements a peering.NetworkProvider interface.
func NewNetworkProvider ¶
func NewNetworkProvider(myNetID string, port int, nodeKeyPair *key.Pair, suite kyber.Group, log *logger.Logger) (*NetImpl, error)
NewNetworkProvider is a constructor for the TCP based peering network implementation.
func (*NetImpl) Attach ¶
func (n *NetImpl) Attach(chainID *coretypes.ChainID, callback func(recv *peering.RecvEvent)) interface{}
Attach implements peering.NetworkProvider.
func (*NetImpl) Close ¶
func (n *NetImpl) Close()
Close implements peering.PeerSender for the Self() node.
func (*NetImpl) Detach ¶
func (n *NetImpl) Detach(attachID interface{})
Detach implements peering.NetworkProvider.
func (*NetImpl) Group ¶
func (n *NetImpl) Group(peerNetIDs []string) (peering.GroupProvider, error)
Group implements peering.NetworkProvider.
func (*NetImpl) PeerByNetID ¶
func (n *NetImpl) PeerByNetID(peerNetID string) (peering.PeerSender, error)
PeerByNetID implements peering.NetworkProvider.
func (*NetImpl) PeerByPubKey ¶
func (n *NetImpl) PeerByPubKey(peerPub kyber.Point) (peering.PeerSender, error)
PeerByPubKey implements peering.NetworkProvider. NOTE: For now, only known nodes can be looked up by PubKey.
func (*NetImpl) PeerStatus ¶
func (n *NetImpl) PeerStatus() []peering.PeerStatusProvider
PeerStatus implements peering.NetworkProvider.
func (*NetImpl) PubKey ¶
func (n *NetImpl) PubKey() kyber.Point
PubKey implements peering.PeerSender for the Self() node.
func (*NetImpl) Run ¶
func (n *NetImpl) Run(shutdownSignal <-chan struct{})
Run starts listening and communicating with the network.
func (*NetImpl) Self ¶
func (n *NetImpl) Self() peering.PeerSender
Self implements peering.NetworkProvider.
func (*NetImpl) SendMsg ¶
func (n *NetImpl) SendMsg(msg *peering.PeerMessage)
SendMsg implements peering.PeerSender for the Self() node.