Documentation ¶
Index ¶
- Constants
- type AkhHost
- func (h *AkhHost) AddPeerManually(remotePeerAddr string, remotePeerID string) (err error)
- func (h *AkhHost) AddStreamHandler(handler StreamHandler)
- func (h *AkhHost) DiscoverPeers()
- func (h *AkhHost) GetBlock(peerID peer.ID, blockHash string) (bd blockchain.BlockData, err error)
- func (h *AkhHost) PublishBlock(b *blockchain.Block)
- func (h *AkhHost) PublishTransaction(t *blockchain.Transaction)
- func (h *AkhHost) PublishVote(v *blockchain.Vote)
- func (h *AkhHost) SendMessage(msg interface{}, peerID peer.ID, proto protocol.ID) (ws *WrappedStream, err error)
- type AnnouncedBlockStreamHandler
- type BlockStreamHandler
- type DiscoverStreamHandler
- type DiscoveryNotifee
- type GetBlockMessage
- type GetPeersMessage
- type Message
- type StreamHandler
- type TestedPeer
- type TransactionStreamHandler
- type VoteStreamHandler
- type WrappedStream
Constants ¶
View Source
const ( BlockProto protocol.ID = protocolsPrefix + "block/1.0.0" TransactionProto = protocolsPrefix + "transaction/1.0.0" BlockAnnounceProto = protocolsPrefix + "blockAnnounce/1.0.0" DiscoverProto = protocolsPrefix + "discover/1.0.0" VoteAnnounceProto = protocolsPrefix + "vote/1.0.0" )
View Source
const DefaultPort = 9765
View Source
const HostsInfoPath = "/tmp/akhhosts.info"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AkhHost ¶
func (*AkhHost) AddPeerManually ¶
remotePeerAddr format: <dot-separated IPv4>:<post>, for example: 127.0.0.1:9000 remotePeerID - unprettyfied ID TODO validation and error handling
func (*AkhHost) AddStreamHandler ¶
func (h *AkhHost) AddStreamHandler(handler StreamHandler)
func (*AkhHost) DiscoverPeers ¶
func (h *AkhHost) DiscoverPeers()
func (*AkhHost) GetBlock ¶
func (h *AkhHost) GetBlock(peerID peer.ID, blockHash string) (bd blockchain.BlockData, err error)
func (*AkhHost) PublishBlock ¶
func (h *AkhHost) PublishBlock(b *blockchain.Block)
func (*AkhHost) PublishTransaction ¶
func (h *AkhHost) PublishTransaction(t *blockchain.Transaction)
func (*AkhHost) PublishVote ¶
func (h *AkhHost) PublishVote(v *blockchain.Vote)
func (*AkhHost) SendMessage ¶
func (h *AkhHost) SendMessage(msg interface{}, peerID peer.ID, proto protocol.ID) (ws *WrappedStream, err error)
type AnnouncedBlockStreamHandler ¶
type AnnouncedBlockStreamHandler struct {
ProcessResult func(bd blockchain.BlockData, peerId peer.ID)
}
type BlockStreamHandler ¶
type BlockStreamHandler struct {
Head **blockchain.Block
}
type DiscoverStreamHandler ¶
type DiscoverStreamHandler struct {
// contains filtered or unexported fields
}
type DiscoveryNotifee ¶
type DiscoveryNotifee struct {
// contains filtered or unexported fields
}
func (*DiscoveryNotifee) HandlePeerFound ¶
func (n *DiscoveryNotifee) HandlePeerFound(peerInfo ps.PeerInfo)
type GetBlockMessage ¶
type GetPeersMessage ¶
type GetPeersMessage struct {
Message
}
type StreamHandler ¶
type StreamHandler interface {
// contains filtered or unexported methods
}
type TestedPeer ¶
type TransactionStreamHandler ¶
type TransactionStreamHandler struct {
ProcessResult func(t blockchain.Transaction)
}
type VoteStreamHandler ¶
type VoteStreamHandler struct {
ProcessResult func(v blockchain.Vote)
}
type WrappedStream ¶
type WrappedStream struct {
// contains filtered or unexported fields
}
func WrapStream ¶
func WrapStream(s inet.Stream) *WrappedStream
Click to show internal directories.
Click to hide internal directories.