Documentation ¶
Index ¶
- Variables
- func CompareHeight(blockHeight uint64, heights []uint64) bool
- func FilterMessage(node protocol.Noder, msgType string) error
- 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
- 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 FilterMessage ¶
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 GetBlockHashes ¶
func InitLocalNode ¶
func SendGetBlocks ¶
Types ¶
type ConnectingNodes ¶
type HandlerBase ¶
type HandlerBase struct {
// contains filtered or unexported fields
}
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) 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) 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 ¶
After message has been successful decoded, this method will be called to pass the decoded message instance
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)