node

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Node

type Node struct {
	Challenge []byte
	// contains filtered or unexported fields
}

Node defines the status of a Dusk node.

type Store

type Store struct {
	sync.RWMutex
	Nodes map[string]*Node
}

Store contains a map to pointers to node elements, where their ip is used as key.

func NewStore

func NewStore() *Store

NewStore creates a new instance of Store.

func (*Store) Add

func (d *Store) Add(ip string, challenge []byte)

Add a node to the list.

func (*Store) BlackList

func (d *Store) BlackList(ip string)

BlackList sets the blacklist flag on the node with the provided ip.

func (*Store) DumpNodes

func (d *Store) DumpNodes(srcPeerID string, _ message.Message) ([]bytes.Buffer, error)

DumpNodes returns a comma separated string of non-blacklisted, active IPs of dusk nodes currently stored.

func (*Store) Get

func (d *Store) Get(ip string) Node

Get a node from the list.

func (*Store) IsBlackListed

func (d *Store) IsBlackListed(ip string) bool

IsBlackListed checks if a node is present in the blacklist.

func (*Store) SetInactive

func (d *Store) SetInactive(ip string)

SetInactive will set a node's status to down. Should be called after definitive disconnect.

func (*Store) SetPort

func (d *Store) SetPort(ip, port string)

SetPort will the listeningPort on a node, which is used when sending addresses to other nodes.

Jump to

Keyboard shortcuts

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