Documentation ¶
Index ¶
- Constants
- Variables
- type Dapmsg
- type Node
- func (n *Node) AddStream(peerid peer.ID, targetAddr ma.Multiaddr) error
- func (n *Node) AddStreamByString(targetFullAddr string) error
- func (n *Node) AddStreamMultiAddr(targetFullAddr ma.Multiaddr) error
- func (n *Node) BroadcastTxCmd(tx *core.Transaction) error
- func (n *Node) GetBlockchain() *core.Blockchain
- func (n *Node) GetBlocks() []*core.Block
- func (n *Node) GetInfo() *Peer
- func (n *Node) GetPeerID() peer.ID
- func (n *Node) GetPeerList() *PeerList
- func (n *Node) GetPeerMultiaddr() ma.Multiaddr
- func (n *Node) RequestBlockUnicast(hash core.Hash, pid peer.ID) error
- func (n *Node) SendBlock(block *core.Block) error
- func (n *Node) SendBlockUnicast(block *core.Block, pid peer.ID) error
- func (n *Node) Start(listenPort int) error
- func (n *Node) StartRequestLoop()
- func (n *Node) SyncPeers() error
- type Peer
- type PeerList
- func (pl *PeerList) Add(p *Peer)
- func (pl *PeerList) AddMultiple(ps []*Peer)
- func (pl *PeerList) FindNewPeers(newpl *PeerList) *PeerList
- func (pl *PeerList) FromProto(pb proto.Message)
- func (pl *PeerList) GetPeerlist() []*Peer
- func (pl *PeerList) IsInPeerlist(p *Peer) bool
- func (pl *PeerList) ListIsFull() bool
- func (pl *PeerList) MergePeerlist(newpl *PeerList)
- func (pl *PeerList) RemoveOneIP(p *Peer)
- func (pl *PeerList) ToProto() proto.Message
- type Stream
Constants ¶
View Source
const ( SyncBlock = "SyncBlock" SyncPeerList = "SyncPeerList" RequestBlock = "requestBlock" BroadcastTx = "BroadcastTx" TestMsgRadiation = "TestMsgRadiation" )
Variables ¶
View Source
var (
ErrDapMsgNoCmd = errors.New("ERROR: Dappley message has no command input")
)
View Source
var (
ErrInvalidMessageFormat = errors.New("Message format is invalid")
)
View Source
var PEERLISTMAXSIZE = 20
Functions ¶
This section is empty.
Types ¶
type Dapmsg ¶
type Dapmsg struct {
// contains filtered or unexported fields
}
func (*Dapmsg) GetTimestamp ¶
type Node ¶
type Node struct {
// contains filtered or unexported fields
}
func FakeNodeWithPeer ¶
func (*Node) AddStreamByString ¶
func (*Node) AddStreamMultiAddr ¶
AddStreamMultiAddr stream to the targetFullAddr address. If the targetFullAddr is nil, the node goes to listening mode
func (*Node) BroadcastTxCmd ¶
func (n *Node) BroadcastTxCmd(tx *core.Transaction) error
func (*Node) GetBlockchain ¶
func (n *Node) GetBlockchain() *core.Blockchain
func (*Node) GetPeerList ¶
func (*Node) GetPeerMultiaddr ¶
func (*Node) RequestBlockUnicast ¶
func (*Node) SendBlockUnicast ¶
func (*Node) StartRequestLoop ¶
func (n *Node) StartRequestLoop()
type Peer ¶
type Peer struct {
// contains filtered or unexported fields
}
func CreatePeerFromMultiaddr ¶
func CreatePeerFromString ¶
type PeerList ¶
type PeerList struct {
// contains filtered or unexported fields
}
func (*PeerList) FindNewPeers ¶
find the peers in newpl that are not contained in current pl
func (*PeerList) IsInPeerlist ¶
Check if a multiaddress is already existed in the list
func (*PeerList) ListIsFull ¶
func (*PeerList) MergePeerlist ¶
merge two peerlists
func (*PeerList) RemoveOneIP ¶
remove old ip give space for new ip
type Stream ¶
type Stream struct {
// contains filtered or unexported fields
}
func (*Stream) StopStream ¶
func (s *Stream) StopStream()
Click to show internal directories.
Click to hide internal directories.