Documentation ¶
Index ¶
- Variables
- func CompareHeight(blockHeight uint64, heights []uint64) bool
- func GetBlockHashes(startHash common.Uint256, stopHash common.Uint256, maxBlockHashes uint32) ([]*common.Uint256, error)
- func InitLocalNode() protocol.Noder
- func NewNode(magic uint32, conn net.Conn) *node
- func NewVersion(node protocol.Noder) *msg.Version
- func NonTLSDial(nodeAddr string) (net.Conn, error)
- func SendGetBlocks(node protocol.Noder, locator []*common.Uint256, hashStop common.Uint256)
- func TLSDial(nodeAddr string) (net.Conn, error)
- type ConnectingNodes
- type HandlerBase
- func (h *HandlerBase) FilterMessage(msgType string) error
- func (h *HandlerBase) HandleMessage(message p2p.Message) error
- func (h *HandlerBase) OnError(err error)
- func (h *HandlerBase) OnMakeMessage(cmd string) (message p2p.Message, err error)
- func (h *HandlerBase) OnMessageDecoded(message p2p.Message)
- type HandlerEIP001
- type HandlerV0
- type KnownAddress
- type KnownAddressList
- func (al *KnownAddressList) AddKnownAddress(na p2p.NetAddress)
- func (al *KnownAddressList) AddressExisted(uid uint64) bool
- func (al *KnownAddressList) DelAddressFromList(id uint64) bool
- func (al *KnownAddressList) GetAddressCnt() uint64
- func (al *KnownAddressList) NeedMoreAddresses() bool
- func (al *KnownAddressList) RandGetAddresses(nbrAddrs []p2p.NetAddress) []p2p.NetAddress
- func (al *KnownAddressList) RandSelectAddresses() []p2p.NetAddress
- func (al *KnownAddressList) UpdateAddress(id uint64, na p2p.NetAddress)
- func (al *KnownAddressList) UpdateLastDisconn(id uint64)
- type Semaphore
Constants ¶
This section is empty.
Variables ¶
var LocalNode *node
Functions ¶
func CompareHeight ¶
func GetBlockHashes ¶
func InitLocalNode ¶
func SendGetBlocks ¶
Types ¶
type ConnectingNodes ¶
type HandlerBase ¶
type HandlerBase struct {
// contains filtered or unexported fields
}
func NewHandlerBase ¶ added in v0.1.1
func NewHandlerBase(node protocol.Noder) *HandlerBase
NewHandlerBase create a new HandlerBase instance
func (*HandlerBase) FilterMessage ¶ added in v0.1.1
func (h *HandlerBase) FilterMessage(msgType string) error
Extra net nodes will connect through the specific NodeOpenPort only limited messages can go through, such as filterload/getblocks/getdata etc. Otherwise error will be returned
func (*HandlerBase) HandleMessage ¶ added in v0.1.1
func (h *HandlerBase) HandleMessage(message p2p.Message) error
func (*HandlerBase) OnError ¶
func (h *HandlerBase) OnError(err error)
When something wrong on read or decode message this method will callback the error
func (*HandlerBase) OnMakeMessage ¶
func (h *HandlerBase) OnMakeMessage(cmd string) (message p2p.Message, err error)
After message header decoded, this method will be called to create the message instance with the CMD which is the message type of the received message
func (*HandlerBase) OnMessageDecoded ¶
func (h *HandlerBase) OnMessageDecoded(message p2p.Message)
After message has been successful decoded, this method will be called to pass the decoded message instance
type HandlerEIP001 ¶
type HandlerEIP001 struct { HandlerBase // contains filtered or unexported fields }
func NewHandlerEIP001 ¶
func NewHandlerEIP001(node protocol.Noder) *HandlerEIP001
func (*HandlerEIP001) HandleMessage ¶ added in v0.1.1
func (h *HandlerEIP001) HandleMessage(message p2p.Message) error
func (*HandlerEIP001) OnMakeMessage ¶
func (h *HandlerEIP001) OnMakeMessage(cmd string) (message p2p.Message, err error)
After message header decoded, this method will be called to create the message instance with the CMD which is the message type of the received message
func (*HandlerEIP001) OnMessageDecoded ¶
func (h *HandlerEIP001) OnMessageDecoded(message p2p.Message)
After message has been successful decoded, this method will be called to pass the decoded message instance
type HandlerV0 ¶
type HandlerV0 struct { HandlerBase // contains filtered or unexported fields }
func NewHandlerV0 ¶
func (*HandlerV0) HandleMessage ¶ added in v0.1.1
After message has been successful decoded, this method will be called to pass the decoded message instance
func (*HandlerV0) OnMakeMessage ¶
After message header decoded, this method will be called to create the message instance with the CMD which is the message type of the received message
func (*HandlerV0) OnMessageDecoded ¶
type KnownAddress ¶
type KnownAddress struct {
// contains filtered or unexported fields
}
func (*KnownAddress) GetID ¶
func (ka *KnownAddress) GetID() uint64
func (*KnownAddress) LastAttempt ¶
func (ka *KnownAddress) LastAttempt() time.Time
func (*KnownAddress) NetAddress ¶
func (ka *KnownAddress) NetAddress() p2p.NetAddress
func (*KnownAddress) SaveAddr ¶
func (ka *KnownAddress) SaveAddr(na p2p.NetAddress)
type KnownAddressList ¶
type KnownAddressList struct { sync.RWMutex List map[uint64]*KnownAddress // contains filtered or unexported fields }
func (*KnownAddressList) AddKnownAddress ¶
func (al *KnownAddressList) AddKnownAddress(na p2p.NetAddress)
func (*KnownAddressList) AddressExisted ¶
func (al *KnownAddressList) AddressExisted(uid uint64) bool
func (*KnownAddressList) DelAddressFromList ¶
func (al *KnownAddressList) DelAddressFromList(id uint64) bool
func (*KnownAddressList) GetAddressCnt ¶
func (al *KnownAddressList) GetAddressCnt() uint64
func (*KnownAddressList) NeedMoreAddresses ¶
func (al *KnownAddressList) NeedMoreAddresses() bool
func (*KnownAddressList) RandGetAddresses ¶
func (al *KnownAddressList) RandGetAddresses(nbrAddrs []p2p.NetAddress) []p2p.NetAddress
func (*KnownAddressList) RandSelectAddresses ¶
func (al *KnownAddressList) RandSelectAddresses() []p2p.NetAddress
func (*KnownAddressList) UpdateAddress ¶
func (al *KnownAddressList) UpdateAddress(id uint64, na p2p.NetAddress)
func (*KnownAddressList) UpdateLastDisconn ¶
func (al *KnownAddressList) UpdateLastDisconn(id uint64)