nodeinfo

package
v2.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2024 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultConfig = Config{
	EnableBroadcastNodeInfo:   false,
	BroadcastNodeInfoInterval: 5 * time.Minute,
	BroadcastListTTL:          30 * time.Minute,
	NodeMapSize:               1000,
}

DefaultConfig is the default config

Functions

This section is empty.

Types

type Config

type Config struct {
	EnableBroadcastNodeInfo   bool          `yaml:"enableBroadcastNodeInfo"`
	BroadcastNodeInfoInterval time.Duration `yaml:"broadcastNodeInfoInterval"`
	BroadcastListTTL          time.Duration `yaml:"broadcastListTTL"`
	NodeMapSize               int           `yaml:"nodeMapSize"`
}

Config node config

type Info

type Info struct {
	Version   string
	Height    uint64
	Timestamp time.Time
	Address   string
	PeerID    string
}

Info node infomation

type InfoManager

type InfoManager struct {
	lifecycle.Lifecycle
	// contains filtered or unexported fields
}

InfoManager manage delegate node info

func NewInfoManager

func NewInfoManager(cfg *Config, t transmitter, ch chain, privKey crypto.PrivateKey, broadcastListFunc getBroadcastListFunc) *InfoManager

NewInfoManager new info manager

func (*InfoManager) BroadcastNodeInfo

func (dm *InfoManager) BroadcastNodeInfo(ctx context.Context) error

BroadcastNodeInfo broadcast request node info message

func (*InfoManager) GetNodeInfo

func (dm *InfoManager) GetNodeInfo(addr string) (Info, bool)

GetNodeInfo get node info by address

func (*InfoManager) HandleNodeInfo

func (dm *InfoManager) HandleNodeInfo(ctx context.Context, peerID string, msg *iotextypes.NodeInfo)

HandleNodeInfo handle node info message

func (*InfoManager) HandleNodeInfoRequest

func (dm *InfoManager) HandleNodeInfoRequest(ctx context.Context, peer peer.AddrInfo) error

HandleNodeInfoRequest tell node info to peer

func (*InfoManager) RequestSingleNodeInfoAsync

func (dm *InfoManager) RequestSingleNodeInfoAsync(ctx context.Context, peer peer.AddrInfo) error

RequestSingleNodeInfoAsync unicast request node info message

func (*InfoManager) Start

func (dm *InfoManager) Start(ctx context.Context) error

Start start delegate broadcast task

func (*InfoManager) Stop

func (dm *InfoManager) Stop(ctx context.Context) error

Stop stop delegate broadcast task

Jump to

Keyboard shortcuts

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