utils

package
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 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 CheckExecPluginPaths

func CheckExecPluginPaths(exec string, 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 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 ToNodeID

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

func UpdateJSONKey

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

Update the JSON body if the matching key is found and replace the value. e.g., "whitelisted-subnets" is the key and value is "a,b,c".

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