tcp

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 3, 2021 License: Apache-2.0, BSD-2-Clause Imports: 23 Imported by: 0

Documentation

Overview

Package tcp provides a TCP based implementation of the peering overlay network.

Index

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) Await

func (n *NetImpl) Await(timeout time.Duration) error

Await implements peering.PeerSender for the Self() node.

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) IsAlive

func (n *NetImpl) IsAlive() bool

IsAlive implements peering.PeerSender for the Self() node.

func (*NetImpl) NetID

func (n *NetImpl) NetID() string

NetID implements peering.PeerSender for the Self() node.

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL