Documentation ¶
Index ¶
- Variables
- func BackUpConfig(name string) error
- func CaptureGroups(regEx, input string) (paramsMap map[string]string)
- func CheckWSL() bool
- func CommandOutput(commands string) (string, error)
- func ErrsText(errs []error, sep string) string
- func FindSelfAddress(options renvm.Options) (wire.Address, int, error)
- func GenerateSshKeyAndWriteToDir(name string) error
- func GenesisURL(network multichain.Network) string
- func GetFileURL(network multichain.Network, name string) string
- func GetNodesByTags(tags string) ([]string, error)
- func GithubClient(ctx context.Context) *github.Client
- func HandleErrs(errs []error) error
- func LatestRelease(network multichain.Network) (string, error)
- func NodeConfigPath(name string) string
- func NodeEthereumAddr(pk *id.PrivKey) common.Address
- func NodeExistence(name string) error
- func NodeIP(name string) (string, error)
- func NodeInstanceUser(name string) string
- func NodeOptions(name string) (renvm.Options, error)
- func NodePath(name string) string
- func NodeProvider(name string) (string, error)
- func OpenInBrowser(url string) error
- func OptionsURL(network multichain.Network) string
- func ParseNodesFromNameAndTags(name, tags string) ([]string, error)
- func ParseSshPrivateKey(name string) (ssh.Signer, error)
- func RateLimit(ctx context.Context, client *github.Client) (int, error)
- func RemoteOutput(name, script string) ([]byte, error)
- func RemoteRun(name, script, username string) error
- func Run(name string, args ...string) error
- func SilentRun(name string, args ...string) error
- func SnapshotURL(network multichain.Network, name string) string
- func StringInSlice(target string, list []string) bool
- func StringifySshPubKey(key ssh.PublicKey) string
- func ValidateName(name string) error
- func ValidateTags(have, required string) bool
- func VerifyStatusCode(response *http.Response, expected int) error
Constants ¶
This section is empty.
Variables ¶
var ( // ErrEmptyNameAndTags is returned when both name and tags are not given. ErrEmptyNameAndTags = errors.New("please provide name or tags of the node you want to operate") // ErrTooManyArguments is returned when both name and tags are given. ErrTooManyArguments = errors.New("too many arguments, cannot have both name and tags") // ErrEmptyName is returned when user gives an empty node name. ErrEmptyName = errors.New("node name cannot be empty") )
var Directory = filepath.Join(os.Getenv("HOME"), ".nodectl")
Directory is the directory address of the cli and all nodes data.
var Terraform = filepath.Join(os.Getenv("HOME"), ".nodectl", "bin", "terraform")
Terraform is the path of the terraform binary.
Functions ¶
func BackUpConfig ¶
BackUpConfig copies the config file of the node to the backup folder under .darknode directory in case something unexpected happens.
func CaptureGroups ¶
CaptureGroups returns a map which parses all the capture groups.
func CommandOutput ¶
CommandOutput runs a series of commands with bash
func GenerateSshKeyAndWriteToDir ¶
GenerateSshKeyAndWriteToDir generates a new ssh key and write it to the given path.
func GenesisURL ¶
func GenesisURL(network multichain.Network) string
GenesisURL returns the url of the genesis file on the given network.
func GetFileURL ¶
func GetFileURL(network multichain.Network, name string) string
GetFileURL returns the URL of the requested file in s3, the network input must be a valid network, otherwise function will panic.
func GetNodesByTags ¶
GetNodesByTags return the names of the nodes which have the given tags.
func GithubClient ¶
GithubClient initialize the Github client. If an access token has been set as an environment, it will use it for oauth to avoid rate limiting.
func HandleErrs ¶
HandleErrs checks a list of errors, return the first error encountered, nil otherwise.
func LatestRelease ¶
func LatestRelease(network multichain.Network) (string, error)
LatestRelease fetches the name of the latest Darknode release of given network.
func NodeConfigPath ¶
NodeConfigPath return the absolute path of the given darknode's config file.
func NodeEthereumAddr ¶
NodeEthereumAddr gets the ethereum address of the node with given name.
func NodeExistence ¶
NodeExistence checks if there exists a node with given name. It returns nil if node exists.
func NodeInstanceUser ¶
func NodeOptions ¶
NodeOptions returns the config of the node with given name.
func NodeProvider ¶
NodeProvider returns the provider of the node with given name.
func OpenInBrowser ¶
OpenInBrowser tries to open the url with system default browser. It ignores the error if failing.
func OptionsURL ¶
func OptionsURL(network multichain.Network) string
OptionsURL returns the url of the options template.
func ParseNodesFromNameAndTags ¶
ParseNodesFromNameAndTags returns the darknode names which satisfies the name requirements or the tag requirements.
func RateLimit ¶
RateLimit checks if we get rate-limited by the Github API. It will return how many remaining requests we can make before getting rate-limited
func RemoteOutput ¶
RemoteOutput runs the script on the instance which host the darknode of given name and returns the output of the script.
func SnapshotURL ¶
func SnapshotURL(network multichain.Network, name string) string
SnapshotURL returns the url of the latest snapshot file on the given network.
func StringInSlice ¶
StringInSlice checks whether the string is in the slice
func StringifySshPubKey ¶
func ValidateName ¶
ValidateName validates the given name. It should 1) Only contains letter, number, "-" and "_". 2) No more than 32 characters 3) Not start or end with a whitespace.
func ValidateTags ¶
Types ¶
This section is empty.