nodes

package
v0.93.0 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2026 License: MIT Imports: 5 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SaveNodeIDsToFile

func SaveNodeIDsToFile(filePath string, nodeIDs []string) error

SaveNodeIDsToFile creates a new Nodes struct from node IDs and saves it to the specified path.

Types

type Nodes

type Nodes struct {
	Nodes map[string]struct{} `json:"nodes"`
}

Nodes represents a set of node IDs. This is used to keep track of which nodes are available for a given domain. This struct is serialized to JSON and stored in each domain directory in the `nodes.json` file

func LoadNodesFromFile

func LoadNodesFromFile(filePath string) (*Nodes, error)

LoadNodesFromFile loads nodes from a JSON file at the specified path.

func NewNodes

func NewNodes(nodeIDs []string) *Nodes

NewNodes creates a new Nodes struct with the given node IDs.

func (*Nodes) Add

func (n *Nodes) Add(nodeID string)

Add adds a node ID to the set. It is No-op if already exists.

func (*Nodes) Keys

func (n *Nodes) Keys() []string

Keys returns the node IDs as a slice.

func (*Nodes) SaveToFile

func (n *Nodes) SaveToFile(filePath string) error

SaveToFile saves the nodes to a JSON file at the specified path. If the file already exists, the new nodes will be merged with the existing nodes. If a node with the same id already exists, it will be overwritten.

Jump to

Keyboard shortcuts

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