utils

package
v1.14.33 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2025 License: BSD-3-Clause Imports: 17 Imported by: 8

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidExecPath = errors.New("lux exec is invalid")
	ErrNotExists       = errors.New("lux exec not exists")
	ErrNotExistsPlugin = errors.New("plugin exec not exists")
)

Functions

func CheckExecPath

func CheckExecPath(exec string) error

func CheckPluginPath

func CheckPluginPath(pluginExec string) error

func ColorAndPrepend

func ColorAndPrepend(reader io.Reader, writer io.Writer, prependText string, color log.Color)

ColorAndPrepend reads each line from [reader], prepends it with [prependText] and colors it with [color], and then prints the prepended/colored line to [writer].

func MkDirWithTimestamp

func MkDirWithTimestamp(dirPrefix string) (string, error)

func NetworkIDFromGenesis

func NetworkIDFromGenesis(genesis []byte) (uint32, error)

Returns the network ID in the given genesis

func NewColorPicker

func NewColorPicker() *colorPicker

NewColorPicker allows to assign a color to different clients

func SetJSONKey

func SetJSONKey(jsonBody string, k string, v string) (string, error)

Set k=v in JSON string e.g., "track-chains" is the key and value is "a,b,c".

func ToNodeID

func ToNodeID(stakingKey, stakingCert []byte) (ids.NodeID, error)

func VMID

func VMID(vmName string) (ids.ID, error)

func VerifyChainHasCorrectParticipants added in v1.6.1

func VerifyChainHasCorrectParticipants(
	logger log.Logger,
	chainParticipants []string,
	cluster *rpcb.ClusterInfo,
	chainID string,
) bool

Types

type ColorPicker

type ColorPicker interface {
	// get the next color
	NextColor() log.Color
}

ColorPicker allows to assign a new color

type EncodedNodeKeys added in v1.6.1

type EncodedNodeKeys struct {
	StakingKey  string
	StakingCert string
	BlsKey      string
}

func EncodeNodeKeys added in v1.6.1

func EncodeNodeKeys(key *NodeKeys) *EncodedNodeKeys

type NodeKeys added in v1.6.1

type NodeKeys struct {
	StakingKey  []byte
	StakingCert []byte
	BlsKey      []byte
}

func GenerateKeysForNodes added in v1.6.1

func GenerateKeysForNodes(num int) ([]*NodeKeys, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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