utils

package
v0.0.0-...-48f5a77 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2022 License: BSD-3-Clause Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

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

Functions

func CheckExecPath

func CheckExecPath(exec string) error

func CheckPluginPaths

func CheckPluginPaths(pluginExec string, pluginGenesisPath 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., "whitelisted-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)

Types

type ColorPicker

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

ColorPicker allows to assign a new color

Jump to

Keyboard shortcuts

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