utils

package
v1.11.9 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2024 License: BSD-3-Clause Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidExecPath = errors.New("metal exec is invalid")
	ErrNotExists       = errors.New("metal 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 logging.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-subnets" 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 VerifySubnetHasCorrectParticipants

func VerifySubnetHasCorrectParticipants(
	log logging.Logger,
	subnetParticipants []string,
	cluster *rpcb.ClusterInfo,
	subnetID string,
) bool

Types

type ColorPicker

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

ColorPicker allows to assign a new color

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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