Documentation ¶
Index ¶
- Constants
- Variables
- func CompareHeight(localHeight uint64, heights []uint64) int
- func DisconnectNode(id uint64)
- func GetBlockHashes(startHash common.Uint256, stopHash common.Uint256, maxBlockHashes uint32) ([]*common.Uint256, error)
- func InitLocalNode() protocol.Noder
- func NewNode(conn net.Conn, inbound bool) *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) GetAddressCnt() uint64
- func (al *KnownAddressList) NeedMoreAddresses() bool
- func (al *KnownAddressList) RandGetAddresses() []*p2p.NetAddress
- func (al *KnownAddressList) RandSelectAddresses() []*p2p.NetAddress
- func (al *KnownAddressList) UpdateAddress(na *p2p.NetAddress)
- type Semaphore
Constants ¶
View Source
const ( DumpNodeStateInterval = time.Minute * 5 NodeTitleFormat = "| %-5s | %-16s | %-8s | %-16s | %-5s | %5s | %5s | %5s | %5s | %13s |\n" NodeLineFormat = "| %-5d | %-16x | %-8d | %-16d | %-5t | %5d | %5d | %5d | %5d | %13s |\n" NeighborTitleFormat = "| %-5s | %-16s | %-8s | %-16s | %-5s | %-5s | %-11s | %23s |\n" NeighborLineFormat = "| %-5d | %-16x | %-8d | %-16d | %-5t | %-5t | %-11s | %23s |\n" )
Variables ¶
View Source
var LocalNode *node
Functions ¶
func CompareHeight ¶
func DisconnectNode ¶ added in v0.2.1
func DisconnectNode(id uint64)
func GetBlockHashes ¶
func InitLocalNode ¶
func SendGetBlocks ¶
Types ¶
type ConnectingNodes ¶
type HandlerBase ¶
type HandlerBase struct {
// contains filtered or unexported fields
}
func NewHandlerBase ¶ added in v0.2.0
func NewHandlerBase(node protocol.Noder) *HandlerBase
NewHandlerBase create a new HandlerBase instance
func (*HandlerBase) FilterMessage ¶ added in v0.2.0
func (h *HandlerBase) FilterMessage(msgType string) error
External 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.2.0
func (h *HandlerBase) HandleMessage(message p2p.Message)
func (*HandlerBase) MakeEmptyMessage ¶ added in v0.2.1
func (h *HandlerBase) MakeEmptyMessage(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
type HandlerEIP001 ¶
type HandlerEIP001 struct {
// contains filtered or unexported fields
}
func NewHandlerEIP001 ¶
func NewHandlerEIP001(node protocol.Noder) *HandlerEIP001
func (*HandlerEIP001) HandleMessage ¶ added in v0.2.0
func (h *HandlerEIP001) HandleMessage(message p2p.Message)
func (*HandlerEIP001) MakeEmptyMessage ¶ added in v0.2.1
func (h *HandlerEIP001) MakeEmptyMessage(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
type HandlerV0 ¶
type HandlerV0 struct {
// contains filtered or unexported fields
}
func NewHandlerV0 ¶
func (*HandlerV0) HandleMessage ¶ added in v0.2.0
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) 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[string]*KnownAddress // contains filtered or unexported fields }
func (*KnownAddressList) AddKnownAddress ¶
func (al *KnownAddressList) AddKnownAddress(na *p2p.NetAddress)
func (*KnownAddressList) GetAddressCnt ¶
func (al *KnownAddressList) GetAddressCnt() uint64
func (*KnownAddressList) NeedMoreAddresses ¶
func (al *KnownAddressList) NeedMoreAddresses() bool
func (*KnownAddressList) RandGetAddresses ¶
func (al *KnownAddressList) RandGetAddresses() []*p2p.NetAddress
func (*KnownAddressList) RandSelectAddresses ¶
func (al *KnownAddressList) RandSelectAddresses() []*p2p.NetAddress
func (*KnownAddressList) UpdateAddress ¶
func (al *KnownAddressList) UpdateAddress(na *p2p.NetAddress)
Click to show internal directories.
Click to hide internal directories.