Documentation ¶
Overview ¶
Copyright (C) 2022, Ava Labs, Inc. All rights reserved. See the file LICENSE for licensing terms.
Copyright (C) 2022, Ava Labs, Inc. All rights reserved. See the file LICENSE for licensing terms.
Copyright (C) 2023, Ava Labs, Inc. All rights reserved. See the file LICENSE for licensing terms.
Copyright (C) 2022, Ava Labs, Inc. All rights reserved. See the file LICENSE for licensing terms.
Copyright (C) 2023, Ava Labs, Inc. All rights reserved. See the file LICENSE for licensing terms.
Copyright (C) 2022, Ava Labs, Inc. All rights reserved. See the file LICENSE for licensing terms.
Copyright (C) 2023, Ava Labs, Inc. All rights reserved. See the file LICENSE for licensing terms.
Copyright (C) 2023, Ava Labs, Inc. All rights reserved. See the file LICENSE for licensing terms.
Index ¶
- func AddSingleQuotes(s []string) []string
- func Any[T any](input []T, f func(T) bool) bool
- func ArchSupported(arch string) bool
- func ContainsIgnoreCase(s, substr string) bool
- func ConvertInterfaceToMap(value interface{}) (map[string]interface{}, error)
- func DirectoryExists(dirName string) bool
- func Download(url string) ([]byte, error)
- func DownloadStr(url string) (string, error)
- func DownloadWithTee(url string, path string) ([]byte, error)
- func E2EDocker() bool
- func ExpandHome(path string) string
- func FileCopy(src string, dst string) error
- func FileExists(filename string) bool
- func Filter[T any](input []T, f func(T) bool) []T
- func Find[T any](input []T, f func(T) bool) *T
- func GenDockerComposeFile(nodes int, ubuntuVersion string, networkPrefix string, sshPubKey string) (string, error)
- func GenerateDockerHostIDs(numNodes int) []string
- func GenerateDockerHostIPs(numNodes int) []string
- func GetANRContext() (context.Context, context.CancelFunc)
- func GetAPIContext() (context.Context, context.CancelFunc)
- func GetAPILargeContext() (context.Context, context.CancelFunc)
- func GetCodespaceURL(url string) (string, error)
- func GetGitCommit(gitRepoURL string) string
- func GetIndexInSlice[T comparable](list []T, element T) (int, error)
- func GetRealFilePath(path string) string
- func GetRepoFromCommitURL(gitRepoURL string) (string, string)
- func GetSHA256FromDisk(binPath string) (string, error)
- func GetSSHConnectionString(publicIP, certFilePath string) string
- func GetURIHostPortAndPath(uri string) (string, uint32, string, error)
- func GetUserIPAddress() (string, error)
- func InsideCodespace() bool
- func IsE2E() bool
- func IsExecutable(filename string) bool
- func IsSSHAgentAvailable() bool
- func IsSSHAgentIdentityValid(identity string) (bool, error)
- func IsSSHPubKey(pubkey string) bool
- func IsUnsignedSlice(n []int) bool
- func IsValidIP(ipStr string) bool
- func IsValidURL(urlString string) bool
- func ListSSHAgentIdentities() ([]string, error)
- func Map[T, U any](input []T, f func(T) U) []U
- func MapWithError[T, U any](input []T, f func(T) (U, error)) ([]U, error)
- func NewBlsSecretKeyBytes() ([]byte, error)
- func RandomString(length int) string
- func ReadLongString(msg string, args ...interface{}) (string, error)
- func ReadSSHAgentIdentityPublicKey(identityName string) (string, error)
- func RemoveLineCleanChars(s string) string
- func SaveDockerComposeFile(fileName string, nodes int, ubuntuVersion string, sshPubKey string) (string, error)
- func ScriptLog(nodeID string, msg string, args ...interface{}) string
- func SearchSHA256File(file []byte, toSearch string) (string, error)
- func SetupRealtimeCLIOutput(cmd *exec.Cmd, redirectStdout bool, redirectStderr bool) (*bytes.Buffer, *bytes.Buffer)
- func SortUint32(arr []uint32)
- func SplitComaSeparatedInt(s string) []int
- func SplitComaSeparatedString(s string) []string
- func SplitKeyValueStringToMap(str string, delimiter string) (map[string]string, error)
- func SplitSliceAt[T any](slice []T, index int) ([]T, []T)
- func SplitStringWithQuotes(str string, r rune) []string
- func StartDockerCompose(filePath string) error
- func StopDockerCompose(filePath string) error
- func Sum(s []int) int
- func SupportedAvagoArch() []string
- func TimedFunction(f func() (interface{}, error), name string, timeout time.Duration) (interface{}, error)
- func ToNodeID(certBytes []byte, keyBytes []byte) (ids.NodeID, error)
- func Unique(slice []string) []string
- func UserHomePath(filePath ...string) string
- func ValidateJSON(path string) ([]byte, error)
- type Config
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddSingleQuotes ¶
AddSingleQuotes adds single quotes to each string in the given slice.
func ArchSupported ¶
func ContainsIgnoreCase ¶
containsIgnoreCase checks if the given string contains the specified substring, ignoring case.
func ConvertInterfaceToMap ¶
ConvertInterfaceToMap converts a given value to a map[string]interface{}.
func DirectoryExists ¶
func DownloadStr ¶
func GenDockerComposeFile ¶
func GenDockerComposeFile(nodes int, ubuntuVersion string, networkPrefix string, sshPubKey string) (string, error)
GenDockerComposeFile generates a Docker Compose file with the specified number of nodes and Ubuntu version.
func GenerateDockerHostIDs ¶
GenerateDockerHostIDs generates a list of Docker host IDs.
func GenerateDockerHostIPs ¶
func GetANRContext ¶
func GetANRContext() (context.Context, context.CancelFunc)
Context for ANR network operations
func GetAPIContext ¶
func GetAPIContext() (context.Context, context.CancelFunc)
Context for API requests
func GetAPILargeContext ¶
func GetAPILargeContext() (context.Context, context.CancelFunc)
Context for API requests with large timeout
func GetCodespaceURL ¶
func GetGitCommit ¶
GetGitCommit takes a Git repository URL that contains commit ID and returns the commit ID Example: https://github.com/ava-labs/hypersdk/pull/772/commits/b88acfb370f5aeb83a000aece2d72f28154410a5 Should return b88acfb370f5aeb83a000aece2d72f28154410a5
func GetIndexInSlice ¶
func GetIndexInSlice[T comparable](list []T, element T) (int, error)
func GetRealFilePath ¶
func GetRepoFromCommitURL ¶
GetRepoFromCommitURL takes a Git repository URL that contains commit ID and returns the cloneable Git Repo URL (ends in .git) and the repo directory name Example: https://github.com/ava-labs/hypersdk/pull/772/commits/b88acfb370f5aeb83a000aece2d72f28154410a5 Should return https://github.com/ava-labs/hypersdk
func GetSHA256FromDisk ¶
func GetSSHConnectionString ¶
GetSSHConnectionString returns the SSH connection string for the given public IP and certificate file path.
func GetURIHostPortAndPath ¶
Get the host, port and path from a URL.
func GetUserIPAddress ¶
GetUserIPAddress retrieves the IP address of the user.
func InsideCodespace ¶
func InsideCodespace() bool
func IsE2E ¶
func IsE2E() bool
IsE2E checks if the environment variable "RUN_E2E" is set and returns true if it is, false otherwise.
func IsExecutable ¶
IsExecutable checks if a file is executable.
func IsSSHAgentAvailable ¶
func IsSSHAgentAvailable() bool
isSSHAgentAvailable checks if the SSH agent is available.
func IsSSHAgentIdentityValid ¶
func IsSSHPubKey ¶
IsSSHPubKey checks if the given string is a valid SSH public key.
func IsUnsignedSlice ¶
IsUnsignedSlice returns true if all elements in the slice are unsigned integers.
func ListSSHAgentIdentities ¶
ListSSHAgentIdentity returns a list of SSH identities from ssh-agent.
func MapWithError ¶
func NewBlsSecretKeyBytes ¶
func RandomString ¶
RandomString generates a random string of the specified length.
func ReadLongString ¶
ReadLongString reads a long string from the user input.
func RemoveLineCleanChars ¶
func SaveDockerComposeFile ¶
func SaveDockerComposeFile(fileName string, nodes int, ubuntuVersion string, sshPubKey string) (string, error)
SaveDockerComposeFile saves the Docker Compose file with the specified number of nodes and Ubuntu version.
func SetupRealtimeCLIOutput ¶
func SortUint32 ¶
func SortUint32(arr []uint32)
func SplitComaSeparatedInt ¶
SplitComaSeparatedInt splits a comma-separated string into a slice of integers.
func SplitComaSeparatedString ¶
SplitComaSeparatedString splits and trims a comma-separated string into a slice of strings.
func SplitKeyValueStringToMap ¶
SplitKeyValueStringToMap splits a string with multiple key-value pairs separated by delimiter. Delimiter must be a single character
func SplitSliceAt ¶
SplitSliceAt splits a slice at the given index and returns two new slices.func SplitSliceAt[T any](slice []T, index int) ([]T, []T) {
func SplitStringWithQuotes ¶
SplitString split string with a rune comma ignore quoted
func StartDockerCompose ¶
StartDockerCompose is a function that starts Docker Compose.
func StopDockerCompose ¶
StopDockerCompose stops the Docker Compose services defined in the specified file.
func SupportedAvagoArch ¶
func SupportedAvagoArch() []string
func TimedFunction ¶
func TimedFunction(f func() (interface{}, error), name string, timeout time.Duration) (interface{}, error)
TimedFunction is a function that executes the given function `f` within a specified timeout duration.
func UserHomePath ¶
UserHomePath returns the absolute path of a file located in the user's home directory.
func ValidateJSON ¶
ValidateJSON takes a json string and returns it's byte representation if it contains valid JSON