node

package
v0.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 9, 2018 License: MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var LocalNode *node

Functions

func CompareHeight

func CompareHeight(blockHeight uint64, heights []uint64) bool

func GetBlockHashes

func GetBlockHashes(startHash common.Uint256, stopHash common.Uint256, maxBlockHashes uint32) ([]*common.Uint256, error)

func InitLocalNode

func InitLocalNode() Noder

func NewNode

func NewNode(magic uint32, conn net.Conn) *node

func NewVersion

func NewVersion(node protocol.Noder) *msg.Version

func NonTLSDial

func NonTLSDial(nodeAddr string) (net.Conn, error)

func SendGetBlocks

func SendGetBlocks(node protocol.Noder, locator []*common.Uint256, hashStop common.Uint256)

func TLSDial

func TLSDial(nodeAddr string) (net.Conn, error)

Types

type ConnectingNodes

type ConnectingNodes struct {
	sync.RWMutex
	ConnectingAddrs []string
}

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) AddAddressToKnownAddress

func (al *KnownAddressList) AddAddressToKnownAddress(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)

type MsgHandlerV1

type MsgHandlerV1 struct {
	// contains filtered or unexported fields
}

func (*MsgHandlerV1) OnError

func (h *MsgHandlerV1) OnError(err error)

When something wrong on read or decode message this method will callback the error

func (*MsgHandlerV1) OnMakeMessage

func (h *MsgHandlerV1) 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 (*MsgHandlerV1) OnMessageDecoded

func (h *MsgHandlerV1) OnMessageDecoded(message p2p.Message)

After message has been successful decoded, this method will be called to pass the decoded message instance

type Semaphore

type Semaphore chan struct{}

func MakeSemaphore

func MakeSemaphore(n int) Semaphore

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL