nodeidentity

package
v0.162.4 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package nodeidentity resolves the stable node ID every WB daemon carries, per spec/features/peer-connectivity#req:node-identity.

The ID is 128 random bits, hex-encoded, generated once on first start (or on first `wb peers join`) and stored under the private WB state directory at <state dir>/state/node-id, mode 0600. It is a display and matching identifier, not a secret: renaming the host changes nothing, and a copied state directory yields two nodes sharing one ID, which single-live-session detects on the hub side.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Load

func Load(projectsRoot string, random io.Reader) (string, error)

Load resolves the node ID for a projects root, creating it (and its directory) on first use. random defaults to crypto/rand.Reader; a test may inject a deterministic or fault-injecting reader.

func LoadFile

func LoadFile(path string, random io.Reader) (string, error)

LoadFile is Load with the file path already resolved, so a caller that already knows the WB home (or a test fixture) does not need a second resolution.

func Path

func Path(projectsRoot string) (string, error)

Path returns the node ID file's location for a given projects root, without creating anything.

func PathFromHome

func PathFromHome(home string) string

PathFromHome returns the node ID file's location for a WB home directory that is already resolved (internal/wbhome.Root's return value), for a caller that resolved it once already and must not resolve the same projects root a second time through a second, independent call — see cmd/wb's daemon serve, which reuses its own already-resolved home this way rather than calling Load(projectsRoot, nil) directly.

Types

This section is empty.

Jump to

Keyboard shortcuts

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