alfredo

package module
v0.5.3 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2025 License: Apache-2.0 Imports: 55 Imported by: 1

README

alfredo

golang modules for various things

Documentation

Index

Constants

View Source
const (
	ALFREDO_VERSION = "5Apr2024 - 2000"
	NOT_AVAILABLE   = "N/A"
	VERBOSE_ENV     = "VERBOSE"
)
View Source
const (
	HEADER_AUTHORIZATION = "Authorization"
	HEADER_CONTENT_TYPE  = "Content-Type"
	HEADER_ACCEPT        = "Accept"
	CONTENT_TYPE_JSON    = "application/json"
)
View Source
const (
	DefaultUserCredsConfig = "usercreds.conf"
	ContentType            = "Content-Type"
	ApplicationJson        = "application/json"
	LoginRoute             = "/login"
	LogoutRoute            = "/logout"
	StaticRoute            = "/*"
	//StaticDirRoute         = "./static"
	ExpireTime = 120 //expire JWT token in 120 minutes
)
View Source
const (
	VERSION_FILE = "VERSION"
	RELEASE_FILE = "RELEASE"
)
View Source
const S3_default_credentials_file = "~/.aws/credentials"
View Source
const (
	SSH_DEFAULT_KEY = "~/.ssh/id_rsa"
)
View Source
const (
	TIME_FORMAT_1 = "02Jan06-03:04PM"
)

Variables

View Source
var GitBranch string
View Source
var GitProduction string
View Source
var GitRevision string

GitBranch will be injected with the current git branch name

View Source
var GitTimestamp string
View Source
var GitVersion string

Functions

func AppendStringToFile added in v0.1.2

func AppendStringToFile(filename string, content string) error

func Atoi added in v0.5.3

func Atoi(s string, retOnError int) int

func Atoi64 added in v0.5.3

func Atoi64(s string, retOnError int64) int64

func BlankIsNA added in v0.1.2

func BlankIsNA(s string) string

func BuildVersion added in v0.1.2

func BuildVersion() string

func BuildVersionWithMainBranch added in v0.5.0

func BuildVersionWithMainBranch(mainbranch string) string

func CSVtoArray

func CSVtoArray(tagcsv string) []string

func CalculateETARaw added in v0.5.0

func CalculateETARaw(remaining int64, rateOfChange float64) int64

func CalculatePartSize added in v0.4.1

func CalculatePartSize(objectSize int64) int64

func CalculateRateOfChange added in v0.5.0

func CalculateRateOfChange(unitsProcessed int64, startTime int64, endTime int64) float64

func CalculateTotalParts added in v0.4.1

func CalculateTotalParts(objectSize, partSize int64) int64

func CapturePids added in v0.4.3

func CapturePids(main string, hint string) ([]int, error)

func Chain added in v0.5.3

func Chain(handler http.HandlerFunc, middlewares ...Middleware) http.HandlerFunc

func CheckOpenPortIPV4 added in v0.5.0

func CheckOpenPortIPV4(address string, port int) bool

func CheckOpenPortIPV6 added in v0.5.0

func CheckOpenPortIPV6(address string, port int) bool

func CommentPrintf added in v0.1.2

func CommentPrintf(format string, a ...any)

func CommentPrintln added in v0.1.2

func CommentPrintln(cmd string)

func CompareMaps added in v0.4.0

func CompareMaps(mapA, mapB map[string]string) []string

func CompareS3ObjectLists added in v0.5.0

func CompareS3ObjectLists(mapA, mapB []S3Objects) []string

func Concurrent added in v0.4.0

func Concurrent(f func(string) bool, remoteFile string, x int) []bool

Concurrent executes the given function `f` concurrently `x` times and returns the results

func ContentTypeJSON added in v0.4.0

func ContentTypeJSON() (string, string)

func CopyFile added in v0.1.2

func CopyFile(src, dst string) (int64, error)

func CountObjectsAndSize added in v0.5.3

func CountObjectsAndSize(objects []*s3.Object) (int64, int64)

Alternative: If you already have pagination logic, here's a simple counter approach

func CountVersionsAndSize added in v0.5.3

func CountVersionsAndSize(versions []*s3.ObjectVersion, deleteMarkers []*s3.DeleteMarkerEntry) (int64, int64)

For object versions

func CreateGrant added in v0.4.2

func CreateGrant(id string, perm string) grantBucketACLStruct

func CreateTempFile added in v0.5.0

func CreateTempFile(size int64, sparse bool) (string, error)

func DDHumanReadableStorageSize added in v0.4.5

func DDHumanReadableStorageSize(size int64) string

func DbSelfTest added in v0.5.0

func DbSelfTest(dbPath string, query string) error

func DebugPrintf added in v0.1.2

func DebugPrintf(format string, a ...any)

func DebugPrintln added in v0.1.2

func DebugPrintln(cmd string)

func DeepCopyStringToPointer added in v0.4.2

func DeepCopyStringToPointer(s string) *string

func DiffStringBlobs added in v0.5.0

func DiffStringBlobs(a, b string) string

func DiffStringContainers added in v0.5.0

func DiffStringContainers(aLines, bLines []string) string

func DiskDuplicatorArgs added in v0.4.5

func DiskDuplicatorArgs(device string, outputFile string, blockSize int64, count int64) []string

func DmidecodeProduct

func DmidecodeProduct() (string, error)

func EasyBoolErrIsFalse added in v0.5.0

func EasyBoolErrIsFalse(r bool, err error) bool

func EatError added in v0.1.2

func EatError(s string, e error) string

func EatErrorAndReturnInt added in v0.5.3

func EatErrorAndReturnInt(i int, e error, retOnError int) int

func EatErrorReturnString added in v0.4.1

func EatErrorReturnString(s string, e error) string

func EmptyString

func EmptyString(s string) bool

func Error2ExitCode

func Error2ExitCode(err error) int

func ExecToFile

func ExecToFile(cli string, ofile string) (err error)

func ExecToFileAndSpin added in v0.5.0

func ExecToFileAndSpin(cmd string, redirect string) (err error)

func ExpandTilde added in v0.1.3

func ExpandTilde(f string) string

func FileAuthenticate added in v0.4.0

func FileAuthenticate(username, password, filename string) bool

func FileAuthenticatePasscode added in v0.5.0

func FileAuthenticatePasscode(passcode, filename string) bool

func FileBaseContainsDate added in v0.4.0

func FileBaseContainsDate(f string) bool

FileBaseContainsDate : f contains a date

func FileExists

func FileExists(filename string) (bool, error)

func FileExistsEasy

func FileExistsEasy(p string) bool

func FindFiles added in v0.1.2

func FindFiles(root string, pattern string, inType INodeType) []string

func FixURI added in v0.4.4

func FixURI(u string) string

func FormatBytes added in v0.5.3

func FormatBytes(bytes int64) string

FormatBytes converts bytes to human-readable format matching AWS CLI

func GenerateJWTKey added in v0.4.0

func GenerateJWTKey() string

func GenerateMoveCLI added in v0.4.0

func GenerateMoveCLI(f string, suffix string) string

func GenerateRandomAlphanumString added in v0.1.3

func GenerateRandomAlphanumString(n int) string

func GenerateSignature added in v0.1.2

func GenerateSignature(sts, secret string) string

func GetArgsFromPid added in v0.1.3

func GetArgsFromPid(pid int) ([]string, error)

func GetBaseName added in v0.1.3

func GetBaseName(f string) string

func GetClassName added in v0.1.3

func GetClassName(fields []string) string

func GetClassNameLastSegment added in v0.1.3

func GetClassNameLastSegment(className string) string

getLastSegment returns the last segment of a dot-separated class name

func GetDebug added in v0.1.2

func GetDebug() bool

func GetDryRun added in v0.4.5

func GetDryRun() bool

func GetExperimental added in v0.1.3

func GetExperimental() bool

func GetFileFindCLI added in v0.1.2

func GetFileFindCLI(directoryPath string, prefix string, glob string) string

func GetFindFileCLI added in v0.1.3

func GetFindFileCLI(root string, pattern string, inType INodeType) string

func GetFirstFile

func GetFirstFile(rootpath string, hint string) string

func GetFirstLineFromFile added in v0.1.3

func GetFirstLineFromFile(f string) string

func GetFirstLineFromSlice added in v0.1.3

func GetFirstLineFromSlice(content string, needle string) string

func GetFirstOfMonthTimestamp added in v0.4.4

func GetFirstOfMonthTimestamp() string

func GetForce added in v0.1.3

func GetForce() bool

func GetFormattedTime added in v0.1.3

func GetFormattedTime(fmt string) string

func GetFormattedTime1 added in v0.1.3

func GetFormattedTime1() string

func GetLastModifiedTime added in v0.5.0

func GetLastModifiedTime(localFile string) (time.Time, error)

should stat the file and return the last modified time

func GetOutboundIP added in v0.4.0

func GetOutboundIP() string

func GetPanic added in v0.1.2

func GetPanic() bool

func GetPassCode added in v0.4.4

func GetPassCode(filename string) (string, error)

func GetPrivateSSHKey

func GetPrivateSSHKey() string

func GetProcessList added in v0.4.3

func GetProcessList(mainHint string) ([]string, error)

func GetQuiet added in v0.5.0

func GetQuiet() bool

func GetRandomInt64InRange added in v0.5.0

func GetRandomInt64InRange(min, max int64) int64

func GetStringListFromJPS added in v0.1.3

func GetStringListFromJPS(jlist []jpsProcStruct) []string

func GetThreadCount added in v0.1.3

func GetThreadCount(pid int) (int, error)

func GetTopLevelDir added in v0.5.3

func GetTopLevelDir() string

func GetVerbose added in v0.1.2

func GetVerbose() bool

func GoFuncAndSpin added in v0.4.5

func GoFuncAndSpin(cb interface{}, params ...interface{}) error

func Grep

func Grep(path string, musthave string, mustnothave string) ([]string, error)

was "readlines"

func Gunzip

func Gunzip(dst string, r io.Reader) error

Untar takes a destination path and a reader; a tar reader loops over the tarfile creating the file structure at 'dst' along the way, and writing any files

func HasBase added in v0.1.3

func HasBase(filename string, base string) bool

func HighLight

func HighLight(a string, b string, hl string) string

func Hostname

func Hostname() (string, error)

func HumanReadableBigNumber

func HumanReadableBigNumber(n int64) string

func HumanReadableSeconds

func HumanReadableSeconds(s int64) string

func HumanReadableStorageCapacity

func HumanReadableStorageCapacity(b int64) string

func HumanReadableTimeStamp added in v0.5.0

func HumanReadableTimeStamp(t int64) string

func IsCgoEnabled added in v0.4.0

func IsCgoEnabled() bool

func IsIPAddress added in v0.5.3

func IsIPAddress(s string) bool

func IsMonth

func IsMonth(m string) bool

simple test of a 3 character string; month or not a month; Not locale friendly!

func IsMounted added in v0.4.0

func IsMounted(mntpt string) bool

func IsTokenExpired added in v0.5.3

func IsTokenExpired(tokenString string) (bool, error)

IsTokenExpired checks if a JWT token has expired on the client side Returns true if the token is expired, false if still valid, and error if token is malformed

func IsTokenExpiredEasy added in v0.5.3

func IsTokenExpiredEasy(tokenString string) bool

func JPSStructListToIntList added in v0.1.3

func JPSStructListToIntList(jps []jpsProcStruct, classname string) []int

func JsonDeepCopy added in v0.5.0

func JsonDeepCopy(input interface{}) (interface{}, error)

func LoadCredFileMap added in v0.4.0

func LoadCredFileMap(filename string) (map[string]string, error)

func LoadFileIntoSlice

func LoadFileIntoSlice(f string) ([]string, error)

load a file with lines that \n terminated into a slice (used by the syslog self-test)

func LocalExecuteAndSpin added in v0.1.3

func LocalExecuteAndSpin(cli string) error

func MD5SumBA added in v0.1.3

func MD5SumBA(ba []byte) string

func MD5SumFile added in v0.4.1

func MD5SumFile(s string) string

func MD5SumString added in v0.1.3

func MD5SumString(s string) string

func MD5sumChunk

func MD5sumChunk(filePath string, chunkSize int64)

work in progress; want to return string of hash for a partial file

func MD5sumFile

func MD5sumFile(filePath string) (string, error)

func MapToTableSlice added in v0.4.1

func MapToTableSlice(data map[string]string) []string

func MapToTableSliceOrdered added in v0.4.1

func MapToTableSliceOrdered(data map[string]string, order []string) []string

func MkdirAll added in v0.1.2

func MkdirAll(path string) error

func MoveDirs added in v0.1.2

func MoveDirs(needleSuffix string, st int, target string) error

func MoveFile added in v0.1.2

func MoveFile(src string, dst string) error

func MoveFiles added in v0.1.2

func MoveFiles(needleSuffix string, st int, target string) error

func NotBlankIsMasked added in v0.1.2

func NotBlankIsMasked(s string) string

func PairToMap added in v0.4.4

func PairToMap(k, v string) map[string]string

func PanicError added in v0.1.2

func PanicError(msg string) error

func ParseKeyList added in v0.4.5

func ParseKeyList(key string) (string, int64)

func ParseThreadCount added in v0.1.3

func ParseThreadCount(status string) (int, error)

func Popen3

func Popen3(output_buffer *bytes.Buffer, stack ...*exec.Cmd) (err error)

formerly Execute

func Popen3Grep

func Popen3Grep(cmd string, musthave string, mustnothave string) ([]string, error)

func Popen3Grep2 added in v0.4.3

func Popen3Grep2(cmd string, musthave string, mustnothave string) ([]string, error)

func Popen3GrepFast

func Popen3GrepFast(cmd string, musthave string, mustnothave string) ([]string, error)

func PopentoString

func PopentoString(cmd string) (string, error)

func PopentoStringAwk

func PopentoStringAwk(cmd string, awk int) (string, error)

func PrettyPrint

func PrettyPrint(v any) string

generate a "prettyprint" output of the structure

func PrettyPrintJSONFile added in v0.1.2

func PrettyPrintJSONFile(filePath string)

func PrintSortedMap added in v0.4.0

func PrintSortedMap[K comparable, V any](m map[K]V)

func ReadFileToSlice

func ReadFileToSlice(filename string, force bool) ([]string, error)

func ReadStructFromCommand

func ReadStructFromCommand(cli string, structure interface{}) error

func ReadStructFromCommandOverSSH

func ReadStructFromCommandOverSSH(ssh SSHStruct, cli string, structure interface{}) error

func ReadStructFromJSONFile

func ReadStructFromJSONFile(filePath string, structure interface{}) error

simply reads JSON data from a file and populates the provided structure.

func ReadStructFromString

func ReadStructFromString(content string, structure interface{}) error

func RecursiveDelete

func RecursiveDelete(path string) error

func ReduceToBlockSize added in v0.4.5

func ReduceToBlockSize(size int64, blockSize int64) int64

func RemoveFile

func RemoveFile(path string) error

func RemoveFiles added in v0.1.2

func RemoveFiles(directoryPath string, prefix string) error

func RemoveGlob

func RemoveGlob(glob string) error

func RemoveKeyPartialFromSlice added in v0.5.0

func RemoveKeyPartialFromSlice(s string, slice []string) []string

func RemoveTag added in v0.1.2

func RemoveTag(l []string, s string) []string

func RunJPSExample added in v0.5.0

func RunJPSExample()

func RunToLess added in v0.1.3

func RunToLess(cmd1 *exec.Cmd) error

func S3HelperScript added in v0.1.2

func S3HelperScript(profile string, region string, endpoint string) string

func S3HelperScriptBuiltInCreds added in v0.4.0

func S3HelperScriptBuiltInCreds(region string, endpoint string, ak string, sk string) string

func S3HelperScriptBuiltInCredsCreateBucket added in v0.4.0

func S3HelperScriptBuiltInCredsCreateBucket(region string, endpoint string, ak string, sk string, bucket string) string

func S3HelperScriptBuiltInCredsDeepClean added in v0.5.0

func S3HelperScriptBuiltInCredsDeepClean(region string, endpoint string, ak string, sk string) string

func S3HelperScriptBuiltInCredsDeepCleanCommon added in v0.5.0

func S3HelperScriptBuiltInCredsDeepCleanCommon(region string, endpoint string, ak string, sk string, profile string) string

func S3HelperScriptDeepClean added in v0.5.0

func S3HelperScriptDeepClean(profile string, region string, endpoint string) string

func S3ObjectListToMap added in v0.5.0

func S3ObjectListToMap(s3ObjectList []S3Objects) map[string]string

func SSHPopenToString

func SSHPopenToString(hostname string, command string) (string, error)

func Sanitized added in v0.4.0

func Sanitized(s string) string

func SecondsToTimestamp added in v0.5.0

func SecondsToTimestamp(seconds int64) string

func SetDebug added in v0.1.2

func SetDebug(b bool)

func SetDryRun added in v0.4.5

func SetDryRun(d bool)

func SetEnvironment

func SetEnvironment(v *bool, env_var string)

func SetExperimental added in v0.1.3

func SetExperimental(e bool)

func SetForce added in v0.1.3

func SetForce(f bool)

func SetPanic added in v0.1.2

func SetPanic(p bool)

func SetPrivateSSHKey

func SetPrivateSSHKey(newkey string)

func SetQuiet added in v0.5.0

func SetQuiet(q bool)

func SetStringIfNotSet added in v0.1.2

func SetStringIfNotSet(v string, d string) string

func SetVerbose

func SetVerbose(v bool)

func SliceContains

func SliceContains(haystack []string, needle string) bool

func SliceToDoc added in v0.4.4

func SliceToDoc(s []string) string

func SlicetoJPSStruct added in v0.1.3

func SlicetoJPSStruct(lines []string, hint string) []jpsProcStruct

func Spinny

func Spinny(sigChan chan bool)

func StringContainsInCSV added in v0.4.4

func StringContainsInCSV(s string, csv string) bool

func StringToFileOverSSH

func StringToFileOverSSH(outputContent string, remoteserver string, outputfile string) error

write otuput content (including new lines) to file outputfile (including full absolute path) on remoteserver over SSH

func System3

func System3(cmd string) error

func System3toCapturedString added in v0.1.2

func System3toCapturedString(s *string, cmd string) error

func Tail added in v0.4.1

func Tail(filePath string, numLines int) ([]string, error)

Tail reads the last numLines from the file, ignoring Java stack trace lines.

func Targz

func Targz(sourceDir string, outputFilename string, leaveout string) error

func TestEndpoint added in v0.4.0

func TestEndpoint(url string) bool

func TestHost added in v0.4.0

func TestHost(host string) error

func Touch

func Touch(fileName string) error

func TranslateSimilarStructure added in v0.4.2

func TranslateSimilarStructure(input interface{}, output *interface{}) error

func TrimQuotes

func TrimQuotes(s string) string

func TrimSuffix

func TrimSuffix(s, suffix string) string

func TrimTrailingEmptyLines added in v0.5.0

func TrimTrailingEmptyLines(lines []string) []string

func TrueIsYes

func TrueIsYes(b bool) string

func UniqTagSet added in v0.1.2

func UniqTagSet(l []string) []string

func Untar

func Untar(dst string, r io.Reader) error

Untar takes a destination path and a reader; a tar reader loops over the tarfile creating the file structure at 'dst' along the way, and writing any files

func Unzip

func Unzip(destination string, r *zip.ReadCloser) error

Untar takes a destination path and a reader; a tar reader loops over the tarfile creating the file structure at 'dst' along the way, and writing any files

func VerbosePrintf added in v0.1.2

func VerbosePrintf(format string, a ...any)

func VerbosePrintln

func VerbosePrintln(cmd string)

for debugging purposes, a more verbose output to catch attention

func WriteLineToFile added in v0.5.0

func WriteLineToFile(filePath, line string) error

func WriteSliceToFile

func WriteSliceToFile(filename string, content []string) error

func WriteSparseFile

func WriteSparseFile(f string, sizeMin int, sizeMax int, r int) error

write a sparse file f of size, randomly between sizeMin and sizeMax, r random 1's in the 0's. Seek for 0's

func WriteStringToFile

func WriteStringToFile(filename string, content string) error

func WriteStructToJSONFile

func WriteStructToJSONFile(filePath string, structure interface{}) error

simply write a data interface to a json file; shamelessly picked off the internet

func WriteStructToJSONFilePP added in v0.1.2

func WriteStructToJSONFilePP(filePath string, structure interface{}) error

simply write a data interface to a json file; shamelessly picked off the internet

func YoungestFileTime added in v0.1.2

func YoungestFileTime() string

Types

type AWSProfile added in v0.1.3

type AWSProfile struct {
	AccessKeyID     string `ini:"aws_access_key_id"`
	SecretAccessKey string `ini:"aws_secret_access_key"`
}

type BoolMapContainer added in v0.4.0

type BoolMapContainer struct {
	// contains filtered or unexported fields
}

func (*BoolMapContainer) Disable added in v0.4.0

func (m *BoolMapContainer) Disable(key string)

func (*BoolMapContainer) DisableItems added in v0.4.0

func (m *BoolMapContainer) DisableItems(itemsCSV string)

func (*BoolMapContainer) Enable added in v0.4.0

func (m *BoolMapContainer) Enable(key string)

func (*BoolMapContainer) EnableItems added in v0.4.0

func (m *BoolMapContainer) EnableItems(itemsCSV string)

func (*BoolMapContainer) FromCSV added in v0.4.0

func (m *BoolMapContainer) FromCSV(itemsCSV string, s bool)

func (BoolMapContainer) IsEnabled added in v0.4.0

func (m BoolMapContainer) IsEnabled(key string) bool

func (BoolMapContainer) ToCSV added in v0.4.0

func (m BoolMapContainer) ToCSV() string

func (BoolMapContainer) ToSlice added in v0.4.0

func (m BoolMapContainer) ToSlice() []string

type BucketACLStruct added in v0.4.2

type BucketACLStruct struct {
	Owner  ownerBucketACLStruct   `json:"Owner"`
	Grants []grantBucketACLStruct `json:"Grants"`
}

func GenerateDefaultBucketPolicy added in v0.5.0

func GenerateDefaultBucketPolicy(existingAcl BucketACLStruct) BucketACLStruct

func GenerateROBucketPolicy added in v0.4.2

func GenerateROBucketPolicy(existingAcl BucketACLStruct) BucketACLStruct

type BucketSummary added in v0.5.3

type BucketSummary struct {
	TotalObjects int64
	TotalSize    int64
}

BucketSummary holds the summary statistics

type CLIExecutor added in v0.4.4

type CLIExecutor struct {
	// contains filtered or unexported fields
}

func NewCLIExecutor added in v0.4.4

func NewCLIExecutor() *CLIExecutor

func (*CLIExecutor) AsLongRunning added in v0.4.5

func (c *CLIExecutor) AsLongRunning() *CLIExecutor

stick around for 100 days

func (*CLIExecutor) CaptureJavaProcessList added in v0.5.0

func (c *CLIExecutor) CaptureJavaProcessList(jvm string) error

use this instead of execute or local java processes

func (c *CLIExecutor) CreateSymlink(fromFile, toLink string) error

func (*CLIExecutor) DumpOutput added in v0.5.0

func (c *CLIExecutor) DumpOutput() *CLIExecutor

func (*CLIExecutor) Execute added in v0.4.4

func (c *CLIExecutor) Execute() error

func (*CLIExecutor) GetCli added in v0.4.4

func (c *CLIExecutor) GetCli() string

func (*CLIExecutor) GetCommand added in v0.5.0

func (c *CLIExecutor) GetCommand() string

func (*CLIExecutor) GetDirectory added in v0.5.0

func (c *CLIExecutor) GetDirectory() string

func (*CLIExecutor) GetProcListFromResponseBody added in v0.5.0

func (c *CLIExecutor) GetProcListFromResponseBody() []ProcessInfo

func (*CLIExecutor) GetRequestPayload added in v0.5.0

func (c *CLIExecutor) GetRequestPayload() string

func (*CLIExecutor) GetResponseBody added in v0.4.4

func (c *CLIExecutor) GetResponseBody() string

func (*CLIExecutor) GetSSH added in v0.5.0

func (c *CLIExecutor) GetSSH() SSHStruct

func (*CLIExecutor) GetStatusCode added in v0.4.4

func (c *CLIExecutor) GetStatusCode() int

func (*CLIExecutor) GetTrimWhiteSpace added in v0.4.4

func (c *CLIExecutor) GetTrimWhiteSpace() bool

func (*CLIExecutor) HashFile added in v0.5.0

func (c *CLIExecutor) HashFile(fileName string) string

func (*CLIExecutor) IsPortOpen added in v0.5.0

func (c *CLIExecutor) IsPortOpen() bool

func (*CLIExecutor) IsThisPortOpenIPV4 added in v0.5.0

func (c *CLIExecutor) IsThisPortOpenIPV4(ip string, port int) *CLIExecutor

nc -zv 192.168.1.100 80 && echo "Port is open" || echo "Port is closed"

func (*CLIExecutor) NormalizeName added in v0.5.3

func (c *CLIExecutor) NormalizeName(fuzzy string) error

func (*CLIExecutor) WithCaptureStderr added in v0.4.4

func (c *CLIExecutor) WithCaptureStderr(capture bool) *CLIExecutor

func (*CLIExecutor) WithCaptureStdout added in v0.4.4

func (c *CLIExecutor) WithCaptureStdout(capture bool) *CLIExecutor

func (*CLIExecutor) WithCommand added in v0.4.4

func (c *CLIExecutor) WithCommand(command string) *CLIExecutor

func (*CLIExecutor) WithDirectory added in v0.4.5

func (c *CLIExecutor) WithDirectory(directory string) *CLIExecutor

func (*CLIExecutor) WithExitOneIsNotOK added in v0.5.0

func (c *CLIExecutor) WithExitOneIsNotOK() *CLIExecutor

func (*CLIExecutor) WithExitOneIsOK added in v0.5.0

func (c *CLIExecutor) WithExitOneIsOK() *CLIExecutor

func (*CLIExecutor) WithRequestPayload added in v0.4.4

func (c *CLIExecutor) WithRequestPayload(payload string) *CLIExecutor

func (*CLIExecutor) WithResponseBody added in v0.4.4

func (c *CLIExecutor) WithResponseBody(responseBody string) *CLIExecutor

func (*CLIExecutor) WithSSH added in v0.4.4

func (c *CLIExecutor) WithSSH(host, key, user string) *CLIExecutor

func (*CLIExecutor) WithSSHDebug added in v0.5.0

func (c *CLIExecutor) WithSSHDebug(b bool) *CLIExecutor

func (*CLIExecutor) WithSSHStruct added in v0.5.0

func (c *CLIExecutor) WithSSHStruct(s SSHStruct) *CLIExecutor

func (*CLIExecutor) WithSpinny added in v0.4.4

func (c *CLIExecutor) WithSpinny(show bool) *CLIExecutor

func (*CLIExecutor) WithStatusCode added in v0.4.4

func (c *CLIExecutor) WithStatusCode(statusCode int) *CLIExecutor

func (*CLIExecutor) WithTimeout added in v0.4.4

func (c *CLIExecutor) WithTimeout(timeout time.Duration) *CLIExecutor

func (*CLIExecutor) WithTrimWhiteSpace added in v0.4.4

func (c *CLIExecutor) WithTrimWhiteSpace(trim bool) *CLIExecutor

type CaptureType added in v0.4.4

type CaptureType int
const (
	CapNone CaptureType = iota
	CapBoth
	CapStdout
	CapStderr
)

type CopyResult added in v0.4.0

type CopyResult struct {
	SourceKey   string
	TargetKey   string
	Success     bool
	Error       error
	BytesCopied int64
	Duration    time.Duration
	WasSkipped  bool
}

type CrossCopyModeType added in v0.1.3

type CrossCopyModeType int64
const (
	CCMVIAMEMORY CrossCopyModeType = iota
	CCMVIASHELL
	CCMTEMPFILE
)

func GetCCTypeOf added in v0.1.3

func GetCCTypeOf(cc string) CrossCopyModeType

func (CrossCopyModeType) String added in v0.1.3

func (cc CrossCopyModeType) String() string

type DatabaseConfig added in v0.4.4

type DatabaseConfig struct {
	DbPath  string `json:"db_path"`
	Table   string `json:"table"`
	SSHHost string `json:"ssh_host"`
	SSHKey  string `json:"ssh_key"`
	SSHUser string `json:"ssh_user"`
}

type DatabaseStruct added in v0.4.4

type DatabaseStruct struct {
	DbPath string `json:"db_path"`
	Table  string `json:"table"`
	// contains filtered or unexported fields
}

func NewSQLiteDB added in v0.4.4

func NewSQLiteDB() *DatabaseStruct

func (*DatabaseStruct) Avg added in v0.4.4

func (db *DatabaseStruct) Avg(sel string, where string) error

func (*DatabaseStruct) AvgPayload added in v0.4.4

func (db *DatabaseStruct) AvgPayload(c string, where string) string

func (*DatabaseStruct) CLItarget added in v0.4.4

func (db *DatabaseStruct) CLItarget() string

func (*DatabaseStruct) Count added in v0.4.4

func (db *DatabaseStruct) Count(sel string, where string) error

func (*DatabaseStruct) CountPayload added in v0.4.4

func (db *DatabaseStruct) CountPayload(c string, where string) string

func (*DatabaseStruct) Delete added in v0.4.4

func (db *DatabaseStruct) Delete(where string) error

func (*DatabaseStruct) DeletePayload added in v0.4.4

func (db *DatabaseStruct) DeletePayload(where string) string

func (*DatabaseStruct) Execute added in v0.4.4

func (db *DatabaseStruct) Execute() error

func (*DatabaseStruct) GetPayload added in v0.5.0

func (db *DatabaseStruct) GetPayload() string

func (*DatabaseStruct) GetResult added in v0.4.4

func (db *DatabaseStruct) GetResult() string

func (*DatabaseStruct) GetResultFloat added in v0.4.4

func (db *DatabaseStruct) GetResultFloat() float64

func (*DatabaseStruct) GetResultInt added in v0.4.4

func (db *DatabaseStruct) GetResultInt() int

func (*DatabaseStruct) GetResultInt64 added in v0.4.4

func (db *DatabaseStruct) GetResultInt64() int64

func (*DatabaseStruct) LoadConfig added in v0.4.4

func (db *DatabaseStruct) LoadConfig(filePath string) error

func (*DatabaseStruct) Query added in v0.4.4

func (db *DatabaseStruct) Query(query string) error

func (*DatabaseStruct) QueryPayload added in v0.4.4

func (db *DatabaseStruct) QueryPayload(sel string, where string) string

func (*DatabaseStruct) Sum added in v0.4.4

func (db *DatabaseStruct) Sum(sel string, where string) error

func (*DatabaseStruct) SumPayload added in v0.4.4

func (db *DatabaseStruct) SumPayload(c string, where string) string

func (*DatabaseStruct) Update added in v0.4.4

func (db *DatabaseStruct) Update(set string, where string) error

func (*DatabaseStruct) UpdatePayload added in v0.4.4

func (db *DatabaseStruct) UpdatePayload(set string, where string) string

func (*DatabaseStruct) WithDbPath added in v0.4.4

func (db *DatabaseStruct) WithDbPath(path string) *DatabaseStruct

func (*DatabaseStruct) WithSSH added in v0.4.4

func (db *DatabaseStruct) WithSSH(host string, key string) *DatabaseStruct

func (*DatabaseStruct) WithTable added in v0.4.4

func (db *DatabaseStruct) WithTable(table string) *DatabaseStruct

type ExecCallBackFunc added in v0.1.2

type ExecCallBackFunc func(*string, string) error

type ExecStruct added in v0.1.2

type ExecStruct struct {
	SpinSigChan  chan bool
	WatchSigChan chan bool
	ErrChan      chan error
	// contains filtered or unexported fields
}

func (*ExecStruct) Execute added in v0.1.2

func (ex *ExecStruct) Execute() error

func (*ExecStruct) ExecuteOLD added in v0.4.4

func (ex *ExecStruct) ExecuteOLD() error

func (*ExecStruct) ExecutePRE17Jan2025 added in v0.4.4

func (ex *ExecStruct) ExecutePRE17Jan2025() error

func (*ExecStruct) ExecuteSTILLBROKEN added in v0.4.4

func (ex *ExecStruct) ExecuteSTILLBROKEN() error

func (ExecStruct) GetBody added in v0.1.2

func (ex ExecStruct) GetBody() string

func (ExecStruct) GetIface added in v0.1.2

func (ex ExecStruct) GetIface() interface{}

func (ExecStruct) GetMainCli added in v0.4.4

func (ex ExecStruct) GetMainCli() string

func (ExecStruct) GetRequest added in v0.4.4

func (ex ExecStruct) GetRequest() string

func (ExecStruct) GetSSH added in v0.4.4

func (ex ExecStruct) GetSSH() SSHStruct

func (ExecStruct) GetWatcherPayload added in v0.5.0

func (ex ExecStruct) GetWatcherPayload() []byte

func (*ExecStruct) Init added in v0.1.2

func (ex *ExecStruct) Init() *ExecStruct

func (ExecStruct) OkToSpin added in v0.1.2

func (ex ExecStruct) OkToSpin() bool

func (ExecStruct) OkToWatch added in v0.1.2

func (ex ExecStruct) OkToWatch() bool

func (*ExecStruct) WithCapture added in v0.1.2

func (ex *ExecStruct) WithCapture(c bool) *ExecStruct

func (*ExecStruct) WithCaptureBoth added in v0.4.4

func (ex *ExecStruct) WithCaptureBoth() *ExecStruct

func (*ExecStruct) WithDirectory added in v0.1.2

func (ex *ExecStruct) WithDirectory(d string) *ExecStruct

func (*ExecStruct) WithHintInterface added in v0.1.2

func (ex *ExecStruct) WithHintInterface(i interface{}) *ExecStruct

func (*ExecStruct) WithMainCli added in v0.4.4

func (ex *ExecStruct) WithMainCli(cli string) *ExecStruct

func (*ExecStruct) WithMainExecFunc added in v0.1.2

func (ex *ExecStruct) WithMainExecFunc(cb ExecCallBackFunc, cli string) *ExecStruct

func (*ExecStruct) WithProgressExecFunc added in v0.1.2

func (ex *ExecStruct) WithProgressExecFunc(cb ProgressCallBackFunc) *ExecStruct

func (*ExecStruct) WithRequest added in v0.4.4

func (ex *ExecStruct) WithRequest(r string) *ExecStruct

func (*ExecStruct) WithSSH added in v0.1.2

func (ex *ExecStruct) WithSSH(ssh SSHStruct) *ExecStruct

func (*ExecStruct) WithSpinny added in v0.1.2

func (ex *ExecStruct) WithSpinny(b bool) *ExecStruct

func (*ExecStruct) WithWatcherExecFunc added in v0.1.2

func (ex *ExecStruct) WithWatcherExecFunc(cb WatcherCallBackFunc, payload []byte) *ExecStruct

type Expiration added in v0.4.4

type Expiration struct {
	Days int    `xml:"Days,omitempty"`
	Date string `xml:"Date,omitempty"`
}

Expiration represents an expiration in a rule

type FilenameStruct added in v0.1.2

type FilenameStruct struct {
	// contains filtered or unexported fields
}

func GenerateFilename added in v0.4.0

func GenerateFilename(f string, suffix string) FilenameStruct

func (FilenameStruct) GetBase added in v0.1.2

func (fns FilenameStruct) GetBase() string

func (FilenameStruct) GetExt added in v0.1.2

func (fns FilenameStruct) GetExt() string

func (FilenameStruct) GetFullName added in v0.1.2

func (fns FilenameStruct) GetFullName() string

func (FilenameStruct) GetHasDate added in v0.1.2

func (fns FilenameStruct) GetHasDate() bool

func (FilenameStruct) GetModTime added in v0.1.2

func (fns FilenameStruct) GetModTime() string

func (FilenameStruct) GetPath added in v0.1.2

func (fns FilenameStruct) GetPath() string

func (*FilenameStruct) GetStat added in v0.1.2

func (fns *FilenameStruct) GetStat() error

func (*FilenameStruct) Parse added in v0.1.2

func (fns *FilenameStruct) Parse(f string) error

func (*FilenameStruct) SetBase added in v0.1.2

func (fns *FilenameStruct) SetBase(b string)

func (*FilenameStruct) SetExt added in v0.1.2

func (fns *FilenameStruct) SetExt(e string)

func (*FilenameStruct) SetFullName added in v0.1.2

func (fns *FilenameStruct) SetFullName(f string)

func (*FilenameStruct) SetHasDate added in v0.1.2

func (fns *FilenameStruct) SetHasDate(b bool)

func (*FilenameStruct) SetModTime added in v0.1.2

func (fns *FilenameStruct) SetModTime(mt string)

func (*FilenameStruct) SetPath added in v0.1.2

func (fns *FilenameStruct) SetPath(p string)

func (FilenameStruct) WithBase added in v0.1.2

func (fns FilenameStruct) WithBase(b string) FilenameStruct

func (FilenameStruct) WithExt added in v0.1.2

func (fns FilenameStruct) WithExt(e string) FilenameStruct

func (FilenameStruct) WithFullName added in v0.1.2

func (fns FilenameStruct) WithFullName(f string) FilenameStruct

func (FilenameStruct) WithHasDate added in v0.1.2

func (fns FilenameStruct) WithHasDate(b bool) FilenameStruct

func (FilenameStruct) WithModTime added in v0.1.2

func (fns FilenameStruct) WithModTime(mt string) FilenameStruct

func (FilenameStruct) WithPath added in v0.1.2

func (fns FilenameStruct) WithPath(p string) FilenameStruct

type Filter added in v0.4.4

type Filter struct {
	Prefix string `xml:"Prefix"`
}

Filter represents the filter for a rule

type HttpApiStruct added in v0.4.4

type HttpApiStruct struct {
	UserName string `json:"userName"`
	Password string `json:"password"`

	Fqdn string `json:"fqdn"`

	Timeout     int               `json:"timeout"`
	QueryParams map[string]string `json:"queryParams"`
	Headers     map[string]string `json:"headers"`

	Secure bool `json:"secure"`

	Port           int    `json:"port"`
	IgnoreConflict bool   `json:"ignoreConflict"`
	Passcode       string `json:"passcode"`
	// contains filtered or unexported fields
}

func (*HttpApiStruct) AcquireTokenFromPasscode added in v0.4.4

func (has *HttpApiStruct) AcquireTokenFromPasscode(passcode string) error

func (HttpApiStruct) BuildCurlCLI added in v0.4.4

func (has HttpApiStruct) BuildCurlCLI(method string, uri string) string

func (*HttpApiStruct) GetForceLocal added in v0.4.4

func (has *HttpApiStruct) GetForceLocal() bool

func (HttpApiStruct) GetHeader added in v0.4.4

func (has HttpApiStruct) GetHeader(n string) string

func (HttpApiStruct) GetHeaders added in v0.4.4

func (has HttpApiStruct) GetHeaders() map[string]string

func (HttpApiStruct) GetPasscode added in v0.5.3

func (has HttpApiStruct) GetPasscode() string

func (HttpApiStruct) GetPayload added in v0.4.4

func (has HttpApiStruct) GetPayload() []byte

func (HttpApiStruct) GetPort added in v0.4.4

func (has HttpApiStruct) GetPort() int

func (HttpApiStruct) GetProtocol added in v0.4.4

func (has HttpApiStruct) GetProtocol() string

func (HttpApiStruct) GetQueryParams added in v0.4.4

func (has HttpApiStruct) GetQueryParams() map[string]string

func (HttpApiStruct) GetQueryParamsAsCurlParams added in v0.4.4

func (has HttpApiStruct) GetQueryParamsAsCurlParams() string

func (HttpApiStruct) GetQueryParamsAsURI added in v0.4.4

func (has HttpApiStruct) GetQueryParamsAsURI() string

func (HttpApiStruct) GetResponseBody added in v0.4.4

func (has HttpApiStruct) GetResponseBody() []byte

func (HttpApiStruct) GetSSH added in v0.4.4

func (has HttpApiStruct) GetSSH() SSHStruct

func (HttpApiStruct) GetSSHEnabled added in v0.4.4

func (has HttpApiStruct) GetSSHEnabled() bool

func (HttpApiStruct) GetStatusCode added in v0.4.4

func (has HttpApiStruct) GetStatusCode() int

func (HttpApiStruct) GetTimeout added in v0.4.4

func (has HttpApiStruct) GetTimeout() int

func (HttpApiStruct) GetToken added in v0.5.0

func (has HttpApiStruct) GetToken() string

func (*HttpApiStruct) HammerTest added in v0.4.4

func (has *HttpApiStruct) HammerTest() error

func (HttpApiStruct) HasFqdn added in v0.4.4

func (has HttpApiStruct) HasFqdn() bool

func (*HttpApiStruct) HasHeader added in v0.4.4

func (has *HttpApiStruct) HasHeader(n string) bool

func (*HttpApiStruct) HttpApiCall added in v0.4.4

func (has *HttpApiStruct) HttpApiCall(method string, uri string) error

func (HttpApiStruct) IsPayloadEmpty added in v0.4.4

func (has HttpApiStruct) IsPayloadEmpty() bool

func (*HttpApiStruct) Load added in v0.4.4

func (has *HttpApiStruct) Load(filename string) error

func (*HttpApiStruct) ParseFromURL added in v0.4.4

func (has *HttpApiStruct) ParseFromURL(urlStr string) (string, error)

func (*HttpApiStruct) SetAcceptHeader added in v0.4.4

func (has *HttpApiStruct) SetAcceptHeader(v string)

func (*HttpApiStruct) SetAuthorizationHeader added in v0.4.4

func (has *HttpApiStruct) SetAuthorizationHeader(v string)

func (*HttpApiStruct) SetContentTypeHeader added in v0.4.4

func (has *HttpApiStruct) SetContentTypeHeader(v string)

func (*HttpApiStruct) SetContentTypeHeaderJSON added in v0.4.4

func (has *HttpApiStruct) SetContentTypeHeaderJSON()

func (*HttpApiStruct) SetForceLocal added in v0.4.4

func (has *HttpApiStruct) SetForceLocal(b bool)

func (*HttpApiStruct) SetFqdn added in v0.4.4

func (has *HttpApiStruct) SetFqdn(fqdn string)

func (*HttpApiStruct) SetHeader added in v0.4.4

func (has *HttpApiStruct) SetHeader(n string, v string)

func (*HttpApiStruct) SetHeaders added in v0.4.4

func (has *HttpApiStruct) SetHeaders(h map[string]string)

func (*HttpApiStruct) SetPasscode added in v0.5.3

func (has *HttpApiStruct) SetPasscode(passcode string) *HttpApiStruct

func (*HttpApiStruct) SetPayload added in v0.4.4

func (has *HttpApiStruct) SetPayload(p []byte)

func (*HttpApiStruct) SetPayloadAny added in v0.4.4

func (has *HttpApiStruct) SetPayloadAny(v any) error

func (*HttpApiStruct) SetPort added in v0.4.4

func (has *HttpApiStruct) SetPort(p int)

func (*HttpApiStruct) SetQueryPair added in v0.4.4

func (has *HttpApiStruct) SetQueryPair(n string, v string)

func (*HttpApiStruct) SetQueryPairBool added in v0.4.4

func (has *HttpApiStruct) SetQueryPairBool(n string, v bool)

func (*HttpApiStruct) SetQueryPairFloat added in v0.4.4

func (has *HttpApiStruct) SetQueryPairFloat(n string, v float64)

func (*HttpApiStruct) SetQueryPairInt added in v0.4.4

func (has *HttpApiStruct) SetQueryPairInt(n string, v int)

func (*HttpApiStruct) SetQueryPairInt64 added in v0.4.4

func (has *HttpApiStruct) SetQueryPairInt64(n string, v int64)

func (*HttpApiStruct) SetQueryParams added in v0.4.4

func (has *HttpApiStruct) SetQueryParams(qp map[string]string)

func (*HttpApiStruct) SetQueryParamsByURI added in v0.4.4

func (has *HttpApiStruct) SetQueryParamsByURI(uri string)

func (*HttpApiStruct) SetResponseBody added in v0.4.4

func (has *HttpApiStruct) SetResponseBody(b []byte)

func (*HttpApiStruct) SetSSH added in v0.4.4

func (has *HttpApiStruct) SetSSH(s SSHStruct)

func (*HttpApiStruct) SetStatusCode added in v0.4.4

func (has *HttpApiStruct) SetStatusCode(s int)

func (*HttpApiStruct) SetTimeout added in v0.4.4

func (has *HttpApiStruct) SetTimeout(t int)

func (*HttpApiStruct) SetToken added in v0.5.3

func (has *HttpApiStruct) SetToken(t string)

func (HttpApiStruct) WithFqdn added in v0.4.4

func (has HttpApiStruct) WithFqdn(fqdn string) HttpApiStruct

func (HttpApiStruct) WithHeaders added in v0.4.4

func (has HttpApiStruct) WithHeaders(h map[string]string) HttpApiStruct

func (HttpApiStruct) WithPayload added in v0.4.4

func (has HttpApiStruct) WithPayload(p []byte) HttpApiStruct

func (HttpApiStruct) WithPayloadAny added in v0.4.4

func (has HttpApiStruct) WithPayloadAny(v any) HttpApiStruct

func (HttpApiStruct) WithPort added in v0.4.4

func (has HttpApiStruct) WithPort(p int) HttpApiStruct

func (HttpApiStruct) WithQueryParams added in v0.4.4

func (has HttpApiStruct) WithQueryParams(qp map[string]string) HttpApiStruct

func (HttpApiStruct) WithQueryParamsByURI added in v0.4.4

func (has HttpApiStruct) WithQueryParamsByURI(uri string) HttpApiStruct

func (HttpApiStruct) WithResponseBody added in v0.4.4

func (has HttpApiStruct) WithResponseBody(b []byte) HttpApiStruct

func (HttpApiStruct) WithSSH added in v0.4.4

func (has HttpApiStruct) WithSSH(s SSHStruct) HttpApiStruct

func (HttpApiStruct) WithStatusCode added in v0.4.4

func (has HttpApiStruct) WithStatusCode(s int) HttpApiStruct

func (HttpApiStruct) WithTimeout added in v0.4.4

func (has HttpApiStruct) WithTimeout(t int) HttpApiStruct

type HttpMethod added in v0.4.4

type HttpMethod string
const (
	HttpGET     HttpMethod = "GET"
	HttpPOST    HttpMethod = "POST"
	HttpPUT     HttpMethod = "PUT"
	HttpDELETE  HttpMethod = "DELETE"
	HttpHEAD    HttpMethod = "HEAD"
	HttpOPTIONS HttpMethod = "OPTIONS"
	HttpPATCH   HttpMethod = "PATCH"
)

type INodeType added in v0.1.3

type INodeType int64
const (
	AllInodes INodeType = iota
	RegFileInodes
	DirectoryInodes
	SymlinkInodes
)

func GetFiletype added in v0.1.3

func GetFiletype(t string) INodeType

func (INodeType) String added in v0.1.3

func (i INodeType) String() string

type JWTServer added in v0.5.3

type JWTServer struct {
	// contains filtered or unexported fields
}

func (*JWTServer) AddRoute added in v0.5.3

func (s *JWTServer) AddRoute(pattern string, handler http.HandlerFunc, protected bool, middlewares ...Middleware)

func (*JWTServer) JWTMiddleware added in v0.5.3

func (s *JWTServer) JWTMiddleware(next http.HandlerFunc) http.HandlerFunc

func (*JWTServer) MiddleWareRequireRole added in v0.5.3

func (s *JWTServer) MiddleWareRequireRole(role string) Middleware

func (*JWTServer) NoopMiddleware added in v0.5.3

func (s *JWTServer) NoopMiddleware() Middleware

func (*JWTServer) ServeStaticDirectory added in v0.5.3

func (s *JWTServer) ServeStaticDirectory(pattern string, dir string)

func (*JWTServer) ServeStaticFile added in v0.5.3

func (s *JWTServer) ServeStaticFile(pattern string, fileName string)
func (s *JWTServer) ServeStaticDirectory(pattern string, dir string) {
	if len(dir) == 0 {
		dir = s.staticDir
	}
	log.Printf("Serving static files from %s at %s", dir, pattern)
	fs := http.FileServer(http.Dir(dir))
	s.router.Handle(pattern, http.StripPrefix(pattern, fs))
}

func (*JWTServer) Start added in v0.5.3

func (s *JWTServer) Start() error

type JwtClaims added in v0.4.0

type JwtClaims struct {
	Username string `json:"username"`
	jwt.RegisteredClaims
}

type JwtCredentials added in v0.4.0

type JwtCredentials struct {
	Username string `json:"username"`
	Password string `json:"password"`
	PassCode string `json:"passcode"`
}

type JwtHttpsServerStruct added in v0.4.0

type JwtHttpsServerStruct struct {
	Port   int
	Router *chi.Mux

	StaticDirRoute string
	// contains filtered or unexported fields
}

func (*JwtHttpsServerStruct) AcquireKey added in v0.4.0

func (jhs *JwtHttpsServerStruct) AcquireKey(f string)

func (*JwtHttpsServerStruct) AuthMiddleware added in v0.4.0

func (jhs *JwtHttpsServerStruct) AuthMiddleware(next http.HandlerFunc) http.HandlerFunc

func (JwtHttpsServerStruct) GetCertFiles added in v0.4.0

func (jhs JwtHttpsServerStruct) GetCertFiles() (string, string)

func (JwtHttpsServerStruct) GetKey added in v0.4.0

func (jhs JwtHttpsServerStruct) GetKey() []byte

func (JwtHttpsServerStruct) GetPort added in v0.4.0

func (jhs JwtHttpsServerStruct) GetPort() int

func (JwtHttpsServerStruct) GetStaticDirRoute added in v0.4.4

func (jhs JwtHttpsServerStruct) GetStaticDirRoute() string

func (*JwtHttpsServerStruct) Init added in v0.4.0

func (jhs *JwtHttpsServerStruct) Init(port int)

func (JwtHttpsServerStruct) RouteExists added in v0.4.0

func (jhs JwtHttpsServerStruct) RouteExists(r string) bool

func (*JwtHttpsServerStruct) SetCertFiles added in v0.4.0

func (jhs *JwtHttpsServerStruct) SetCertFiles(priv, pub string)

func (*JwtHttpsServerStruct) SetKey added in v0.4.0

func (jhs *JwtHttpsServerStruct) SetKey(k []byte)

func (*JwtHttpsServerStruct) SetPort added in v0.4.0

func (jhs *JwtHttpsServerStruct) SetPort(p int)

func (*JwtHttpsServerStruct) SetStaticDirRoute added in v0.4.4

func (jhs *JwtHttpsServerStruct) SetStaticDirRoute(dir string)

func (*JwtHttpsServerStruct) SetupStaticRoutes added in v0.5.0

func (jhs *JwtHttpsServerStruct) SetupStaticRoutes(index string)
func (jhs *JwtHttpsServerStruct) SetLoginHandler(h http.Handler) {
	r = chi.NewRouter()
	r.Post("/login", h)
	return r
	// if !jhs.pathMap[LoginRoute] {
	// 	jhs.Router.Post(LoginRoute, h)
	// }
}

func (*JwtHttpsServerStruct) StartServer added in v0.4.0

func (jhs *JwtHttpsServerStruct) StartServer() error

func (*JwtHttpsServerStruct) UpdateClaims added in v0.4.0

func (jhs *JwtHttpsServerStruct) UpdateClaims(username string, w http.ResponseWriter)

func (JwtHttpsServerStruct) ValidateBearerToken added in v0.4.0

func (jhs JwtHttpsServerStruct) ValidateBearerToken(w http.ResponseWriter, r *http.Request) bool

func (JwtHttpsServerStruct) WithKey added in v0.4.0

func (JwtHttpsServerStruct) WithPort added in v0.4.0

func (JwtHttpsServerStruct) WithStaticDirRoute added in v0.4.4

func (jhs JwtHttpsServerStruct) WithStaticDirRoute(dir string) JwtHttpsServerStruct

type LifecycleConfiguration added in v0.4.4

type LifecycleConfiguration struct {
	XMLName xml.Name `xml:"LifecycleConfiguration"`
	Rules   []Rule   `xml:"Rule"`
}

func (*LifecycleConfiguration) String added in v0.4.4

func (blc *LifecycleConfiguration) String() string

func (*LifecycleConfiguration) ToByteArray added in v0.4.4

func (blc *LifecycleConfiguration) ToByteArray() []byte

type LoginResponse added in v0.5.3

type LoginResponse struct {
	Token string `json:"token"`
}

type MemoryManagementOptions added in v0.5.0

type MemoryManagementOptions struct {
	// Interval between memory checks
	Interval time.Duration
	// ForceGC determines if garbage collection should be forced
	ForceGC bool
	// MemoryThreshold in bytes to trigger alerts (0 for disabled)
	MemoryThreshold uint64
	// Custom logger (optional)
	Logger *log.Logger
}

Options for memory manager

func DefaultMMOptions added in v0.5.0

func DefaultMMOptions() *MemoryManagementOptions

DefaultOptions returns sensible default options

func (*MemoryManagementOptions) WithDefaultLogger added in v0.5.0

func (options *MemoryManagementOptions) WithDefaultLogger() *MemoryManagementOptions

func (*MemoryManagementOptions) WithForceGC added in v0.5.0

func (options *MemoryManagementOptions) WithForceGC(forceGC bool) *MemoryManagementOptions

func (*MemoryManagementOptions) WithInterval added in v0.5.0

func (options *MemoryManagementOptions) WithInterval(interval time.Duration) *MemoryManagementOptions

func (*MemoryManagementOptions) WithLogger added in v0.5.0

func (options *MemoryManagementOptions) WithLogger(logger *log.Logger) *MemoryManagementOptions

func (*MemoryManagementOptions) WithMemoryThreshold added in v0.5.0

func (options *MemoryManagementOptions) WithMemoryThreshold(threshold uint64) *MemoryManagementOptions

type MemoryManager added in v0.5.0

type MemoryManager struct {
	// contains filtered or unexported fields
}

MemoryManager manages memory and outputs to logs

func NewMemoryManager added in v0.5.0

func NewMemoryManager(options MemoryManagementOptions) *MemoryManager

New creates a new memory manager with the given options

func (*MemoryManager) Start added in v0.5.0

func (mm *MemoryManager) Start()

Start begins memory monitoring in a goroutine

func (*MemoryManager) Stop added in v0.5.0

func (mm *MemoryManager) Stop()

Stop cancels the memory monitoring goroutine

type MemoryStats added in v0.5.0

type MemoryStats struct {
	Alloc      uint64
	TotalAlloc uint64
	Sys        uint64
	NumGC      uint32
	HeapAlloc  uint64
	HeapSys    uint64
	HeapIdle   uint64
	HeapInUse  uint64
}

MemoryStats contains memory statistics

type Middleware added in v0.5.3

type Middleware func(http.HandlerFunc) http.HandlerFunc

func MiddleWareWithLogging added in v0.5.3

func MiddleWareWithLogging(logger *log.Logger) Middleware

type MigrationMgrStruct added in v0.4.5

type MigrationMgrStruct struct {
	SourceS3   *S3ClientSession
	TargetS3   *S3ClientSession
	Progress   *ProgressTracker
	ErrorMsg   string
	SourceHead *s3.HeadObjectOutput
	TargetHead *s3.HeadObjectOutput

	WorkerPool chan struct{}
	// contains filtered or unexported fields
}

func NewMigrationManager added in v0.4.5

func NewMigrationManager(sourceS3 *S3ClientSession, targetS3 *S3ClientSession, progress *ProgressTracker, batchSize int) *MigrationMgrStruct

func (*MigrationMgrStruct) CopyObjectBetweenBucketsMPU added in v0.4.5

func (mgr *MigrationMgrStruct) CopyObjectBetweenBucketsMPU() error

func (*MigrationMgrStruct) CopyObjectBetweenBucketsRegular added in v0.4.5

func (mgr *MigrationMgrStruct) CopyObjectBetweenBucketsRegular() error

func (*MigrationMgrStruct) DeepCopy added in v0.4.5

func (mgr *MigrationMgrStruct) DeepCopy() *MigrationMgrStruct

func (*MigrationMgrStruct) IsDone added in v0.4.5

func (mgr *MigrationMgrStruct) IsDone() bool

func (*MigrationMgrStruct) Lock added in v0.4.5

func (mgr *MigrationMgrStruct) Lock()

func (*MigrationMgrStruct) MigrateObject added in v0.4.5

func (mgr *MigrationMgrStruct) MigrateObject(size int64) error

func (*MigrationMgrStruct) MigrationBatch added in v0.4.5

func (mgr *MigrationMgrStruct) MigrationBatch(keys []string, wg *sync.WaitGroup, ResultsChan *chan CopyResult) error

func (*MigrationMgrStruct) MigrationLoop added in v0.4.5

func (mgr *MigrationMgrStruct) MigrationLoop(wg *sync.WaitGroup, ResultsChan *chan CopyResult) error

func (*MigrationMgrStruct) Unlock added in v0.4.5

func (mgr *MigrationMgrStruct) Unlock()

type NoncurrentVersionExpiration added in v0.4.4

type NoncurrentVersionExpiration struct {
	NoncurrentDays int `xml:"NoncurrentDays"`
}

NoncurrentVersionExpiration represents an expiration for noncurrent versions

type NoncurrentVersionTransition added in v0.4.4

type NoncurrentVersionTransition struct {
	NoncurrentDays int    `xml:"NoncurrentDays"`
	StorageClass   string `xml:"StorageClass"`
}

NoncurrentVersionTransition represents a transition for noncurrent versions

type ProcessInfo added in v0.5.0

type ProcessInfo struct {
	PID       int    `json:"pid"`
	ClassName string `json:"className"`
}

ProcessInfo holds PID and className

func GetJavaProcesses added in v0.5.0

func GetJavaProcesses(filterClassName string) ([]ProcessInfo, error)

func GetJavaProcessesFromBytes added in v0.5.0

func GetJavaProcessesFromBytes(output []byte, filterClassName string) ([]ProcessInfo, error)

getJavaProcesses returns a slice of ProcessInfo, optionally filtered by className sample line looks like this: 65056 /bin/java -Xmx2g -Xmn400m -Dlog4j.configurationFile=log4j-bucket-tools.xml com.cloudian.tools.bucket.BucketMigration -c md -mode rebuild -ip 192.168.1.31 -tmp /opt/migration/_tmp_ -p migration.properties.bucket1 -retry n -valid off -quit n 33423 /bin/java -Xmx2g -Xmn400m --add-opens java.base/java.math=ALL-UNNAMED --add-opens java.base/java.time=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.util.concurrent=ALLUNNAMED --add-opens java.base/jdk.internal.misc=ALL-UNNAMED -XX:+EnableDynamicAgentLoading -Dlog4j.configurationFile=log4j-bucket-tools.xml com.cloudian.tools.bucket.BucketMigration -mode collect -c ver -tmp /opt/migration/_tmp_ -ip 192.168.1.31 -p migration.properties.versioning-bucket -retry n -v 3 -valid off -quit n

func JPS added in v0.1.3

func JPS() ([]ProcessInfo, error)

type ProgressCallBackFunc added in v0.1.2

type ProgressCallBackFunc func(chan bool)

type ProgressReader added in v0.4.0

type ProgressReader struct {
	io.Reader
	Total    int64
	Uploaded int64
	Key      string
}

ProgressReader wraps an io.Reader and provides progress updates

func (*ProgressReader) Read added in v0.4.0

func (r *ProgressReader) Read(p []byte) (int, error)

type ProgressTracker added in v0.4.0

type ProgressTracker struct {
	TotalObjects    int64
	MigratedObjects int64
	SkippedObjects  int64
	TotalBytes      int64
	CompletedBytes  int64
	FailedObjects   map[string]error
	// contains filtered or unexported fields
}

func (*ProgressTracker) Lock added in v0.4.5

func (p *ProgressTracker) Lock()

func (*ProgressTracker) Unlock added in v0.4.5

func (p *ProgressTracker) Unlock()

type Rule added in v0.4.4

type Rule struct {
	ID                    string                        `xml:"ID,omitempty"`
	Status                string                        `xml:"Status"`
	Filter                Filter                        `xml:"Filter"`
	Transitions           []Transition                  `xml:"Transition,omitempty"`
	Expiration            *Expiration                   `xml:"Expiration,omitempty"`
	NoncurrentTransitions []NoncurrentVersionTransition `xml:"NoncurrentVersionTransition,omitempty"`
	NoncurrentExpiration  *NoncurrentVersionExpiration  `xml:"NoncurrentVersionExpiration,omitempty"`
}

Rule represents a single rule in the lifecycle configuration

type S3ClientSession added in v0.1.2

type S3ClientSession struct {
	Credentials S3credStruct `json:"s3creds"`
	Bucket      string       `json:"bucket"`
	Endpoint    string       `json:"endpoint"`
	Region      string       `json:"region"`
	ObjectKey   string       `json:"key"`
	//	Client      *s3.S3
	Client     s3iface.S3API
	Versioning bool `json:"versioning"`

	PolicyId string `json:"policyid"`

	Response          *http.Response
	ContinuationToken *string
	BatchSize         int `json:"batchSize"`
	WasSkipped        bool
	// contains filtered or unexported fields
}

func (*S3ClientSession) ClearEndpoint added in v0.1.2

func (s3c *S3ClientSession) ClearEndpoint(sep string)

func (*S3ClientSession) CopyAllObjectsBatch added in v0.4.5

func (sourceS3 *S3ClientSession) CopyAllObjectsBatch(
	targetS3 *S3ClientSession,
	progress *ProgressTracker, batchSize int) error

func (S3ClientSession) CopyAllObjectsDoNotUse added in v0.4.5

func (sourceS3 S3ClientSession) CopyAllObjectsDoNotUse(
	targetS3 *S3ClientSession,
	progress *ProgressTracker,
) error

CopyAllObjects copies all objects between S3-compatible systems

func (S3ClientSession) CopyObjectBetweenBuckets added in v0.4.0

func (sourceS3 S3ClientSession) CopyObjectBetweenBuckets(
	targetS3 *S3ClientSession,
	sourceKey string,
	targetKey string,
	progress *ProgressTracker,
) error

CopyObjectBetweenBuckets copies a single object between S3-compatible systems

func (*S3ClientSession) CreateBucket added in v0.1.2

func (s3c *S3ClientSession) CreateBucket() error

func (*S3ClientSession) DeepCopy added in v0.4.5

func (s3c *S3ClientSession) DeepCopy() S3ClientSession

deep copy with a clean new session

func (*S3ClientSession) DeleteBucketLifeCyclePolicy added in v0.4.4

func (s3c *S3ClientSession) DeleteBucketLifeCyclePolicy(rulename string) error

func (S3ClientSession) DeleteObject added in v0.5.0

func (s3c S3ClientSession) DeleteObject(object string) error

func (S3ClientSession) DeleteObjectVersions added in v0.5.0

func (s3c S3ClientSession) DeleteObjectVersions(object string) error

func (*S3ClientSession) DoNotForceSSL added in v0.4.0

func (s3c *S3ClientSession) DoNotForceSSL()

func (*S3ClientSession) EnableLogging added in v0.4.1

func (s3c *S3ClientSession) EnableLogging(l bool)

func (*S3ClientSession) EstablishSession added in v0.1.2

func (s3c *S3ClientSession) EstablishSession() error

func (*S3ClientSession) ForceSSL added in v0.4.0

func (s3c *S3ClientSession) ForceSSL()

func (*S3ClientSession) GenerateLifeCycleRules added in v0.4.4

func (s3c *S3ClientSession) GenerateLifeCycleRules(n int) (LifecycleConfiguration, error)

func (S3ClientSession) GetBucketACL added in v0.4.2

func (sourceS3 S3ClientSession) GetBucketACL() (string, error)

func (*S3ClientSession) GetBucketSummary added in v0.5.3

func (s3c *S3ClientSession) GetBucketSummary(prefix string) (BucketSummary, error)

GetBucketSummary retrieves total object count and size for an S3 bucket

func (*S3ClientSession) GetBucketSummaryWithVersions added in v0.5.3

func (s3c *S3ClientSession) GetBucketSummaryWithVersions(prefix string) (BucketSummary, error)

GetBucketSummaryWithVersions retrieves summary including all object versions

func (*S3ClientSession) GetConcurrency added in v0.4.1

func (s3c *S3ClientSession) GetConcurrency() int

func (*S3ClientSession) GetHashOfObjectRange added in v0.4.3

func (s3c *S3ClientSession) GetHashOfObjectRange(fromChunk int64, chunkSize int64) (string, error)

func (*S3ClientSession) GetObject added in v0.1.3

func (s3c *S3ClientSession) GetObject() ([]byte, error)

func (*S3ClientSession) GetObjectHash added in v0.1.3

func (s3c *S3ClientSession) GetObjectHash() (string, error)

func (*S3ClientSession) GetS3Ptr added in v0.4.0

func (s3c *S3ClientSession) GetS3Ptr() s3iface.S3API

func (*S3ClientSession) GetSession added in v0.4.0

func (s3c *S3ClientSession) GetSession() *session.Session

func (*S3ClientSession) GetSizeOfObject added in v0.4.4

func (s3c *S3ClientSession) GetSizeOfObject() (int64, error)

func (S3ClientSession) GetSkipSize added in v0.4.4

func (s3c S3ClientSession) GetSkipSize() int64

func (*S3ClientSession) GetURL added in v0.1.3

func (s3c *S3ClientSession) GetURL() string

func (S3ClientSession) HeadBucket added in v0.1.2

func (this S3ClientSession) HeadBucket() (bool, error)

func (*S3ClientSession) HeadObject added in v0.1.3

func (s3c *S3ClientSession) HeadObject() (bool, error)

func (*S3ClientSession) IsVersioningEnabled added in v0.1.2

func (s3c *S3ClientSession) IsVersioningEnabled() error

func (S3ClientSession) KeepBucket added in v0.1.2

func (s3c S3ClientSession) KeepBucket() S3ClientSession

func (S3ClientSession) ListBuckets added in v0.1.2

func (s3c S3ClientSession) ListBuckets() []string

func (S3ClientSession) ListObjectsWithSizeFilter added in v0.5.0

func (s3c S3ClientSession) ListObjectsWithSizeFilter(bucket string, sizeFilter int64) ([]S3Objects, error)

func (*S3ClientSession) Load added in v0.4.0

func (s3c *S3ClientSession) Load(filename string) error

func (*S3ClientSession) LoadCredentials added in v0.1.3

func (s3c *S3ClientSession) LoadCredentials(f string) error

f = ~/.aws/credentials

func (*S3ClientSession) LoadUserCredentialsForProfile added in v0.1.3

func (s3c *S3ClientSession) LoadUserCredentialsForProfile() error

func (*S3ClientSession) ObjectExists added in v0.1.3

func (s3c *S3ClientSession) ObjectExists() bool

func (*S3ClientSession) ParseFromURL added in v0.1.3

func (s3c *S3ClientSession) ParseFromURL(url string) error

expected: s3://bucket/object

func (*S3ClientSession) PresignedURL added in v0.1.3

func (s3c *S3ClientSession) PresignedURL(expiredHours int) (string, error)

func (*S3ClientSession) PrintBucketSummary added in v0.5.3

func (s3c *S3ClientSession) PrintBucketSummary(prefix string, includeVersions bool) error

PrintBucketSummary prints the summary in AWS CLI format

func (*S3ClientSession) PutBucketLifeCyclePolicy added in v0.4.4

func (s3c *S3ClientSession) PutBucketLifeCyclePolicy(blc LifecycleConfiguration, extraHeaders map[string]string) error

func (S3ClientSession) RecursiveBucketDelete added in v0.1.2

func (s3c S3ClientSession) RecursiveBucketDelete() error

func (S3ClientSession) RecursiveBucketDeleteAlt added in v0.4.0

func (s3c S3ClientSession) RecursiveBucketDeleteAlt() error

func (S3ClientSession) RecursiveBucketDeleteWithVersions added in v0.5.0

func (s3c S3ClientSession) RecursiveBucketDeleteWithVersions() error

func (S3ClientSession) RemoveBucket added in v0.1.2

func (s3c S3ClientSession) RemoveBucket() error

func (S3ClientSession) S3SyncDirectoryToBucket added in v0.4.0

func (s3c S3ClientSession) S3SyncDirectoryToBucket(dirPath string, progress *ProgressTracker) error

func (S3ClientSession) Save added in v0.4.0

func (s3c S3ClientSession) Save(filename string) error

func (*S3ClientSession) SetBucket added in v0.1.2

func (s3c *S3ClientSession) SetBucket(b string)

func (S3ClientSession) SetBucketACL added in v0.4.2

func (sourceS3 S3ClientSession) SetBucketACL(aclJson string) error

func (*S3ClientSession) SetConcurrency added in v0.4.1

func (s3c *S3ClientSession) SetConcurrency(c int)

func (*S3ClientSession) SetEndpoint added in v0.1.2

func (s3c *S3ClientSession) SetEndpoint(sep string)

func (*S3ClientSession) SetRegion added in v0.1.2

func (s3c *S3ClientSession) SetRegion(r string)

func (*S3ClientSession) SetSession added in v0.4.0

func (s3c *S3ClientSession) SetSession(s *session.Session)

func (*S3ClientSession) SetSkipSize added in v0.4.4

func (s3c *S3ClientSession) SetSkipSize(sz int64)

func (S3ClientSession) SetVersioning added in v0.1.2

func (this S3ClientSession) SetVersioning(v bool) S3ClientSession

func (S3ClientSession) Sync added in v0.1.2

func (this S3ClientSession) Sync(localPath string) error

func (S3ClientSession) SyncInner added in v0.1.2

func (this S3ClientSession) SyncInner(trimsz int, localPath string) error

func (S3ClientSession) WithBucket added in v0.1.2

func (s3c S3ClientSession) WithBucket(b string) S3ClientSession

func (*S3ClientSession) WithCertificateEnforcement added in v0.4.7

func (s3c *S3ClientSession) WithCertificateEnforcement(enforce bool) *S3ClientSession

func (S3ClientSession) WithEndpoint added in v0.1.2

func (s3c S3ClientSession) WithEndpoint(sep string) S3ClientSession

func (S3ClientSession) WithRegion added in v0.1.2

func (s3c S3ClientSession) WithRegion(r string) S3ClientSession

func (S3ClientSession) WithSkipSize added in v0.4.4

func (s3c S3ClientSession) WithSkipSize(sz int64) S3ClientSession

type S3Objects added in v0.5.0

type S3Objects struct {
	Object       string    `json:"object"`
	Size         int64     `json:"size"`
	Etag         string    `json:"etag"`
	Owner        string    `json:"owner"`
	LastModified time.Time `json:"lastModified"`
}

type S3credStruct added in v0.1.2

type S3credStruct struct {
	AccessKey  string `json:"accessKey"`
	Active     bool   `json:"active"`
	CreateDate int64  `json:"createDate"`
	ExpireDate int64  `json:"expireDate"`
	SecretKey  string `json:"secretKey"`
	Profile    string `json:"profile"`
}

func (S3credStruct) CredentialsS3FSPassword added in v0.4.5

func (s3c S3credStruct) CredentialsS3FSPassword() string

func (S3credStruct) CredentialsStanza added in v0.1.2

func (s3c S3credStruct) CredentialsStanza() string

func (S3credStruct) GenerateAWSCLItoString added in v0.1.2

func (s3c S3credStruct) GenerateAWSCLItoString(endpoint string, region string, useSSL bool) string

type SSHStruct

type SSHStruct struct {
	Key  string `json:"key,omitempty"`  //ssh key file, if empty, use ~/.ssh/id_rsa
	User string `json:"user,omitempty"` //ssh user, if empty, use $USER
	Host string `json:"host,omitempty"`

	RemoteDir string `json:"remotedir,omitempty"` //remote directory to execute commands in, if empty, use home dir

	ConnectTimeout int `json:"connecttimeout,omitempty"` //ssh -o ConnectTimeout=10
	// contains filtered or unexported fields
}

func (SSHStruct) BackgroundedRemoteExecute

func (s SSHStruct) BackgroundedRemoteExecute(cli string) (SSHStruct, error)

func (SSHStruct) Chown added in v0.1.2

func (s SSHStruct) Chown(uid int, gid int, path string) error

func (*SSHStruct) CreateClientConfig added in v0.1.3

func (s *SSHStruct) CreateClientConfig() ssh.ClientConfig

func (*SSHStruct) CrossCopy added in v0.1.3

func (srcssh *SSHStruct) CrossCopy(srcFile string, tgtssh SSHStruct, tgtFile string) error

func (*SSHStruct) CrossCopyCLI added in v0.1.3

func (srcssh *SSHStruct) CrossCopyCLI(srcFile string, tgtssh SSHStruct, tgtFile string) string

func (SSHStruct) DownloadCLI

func (s SSHStruct) DownloadCLI(src string, tgt string) string

remote, local

func (*SSHStruct) Execute added in v0.4.4

func (s *SSHStruct) Execute(cli string) error

func (SSHStruct) GenerateRemoteGoBuildCLI added in v0.1.3

func (s SSHStruct) GenerateRemoteGoBuildCLI(binary string) string

func (SSHStruct) GetBody added in v0.1.2

func (s SSHStruct) GetBody() string

func (SSHStruct) GetBodyBytes added in v0.1.3

func (s SSHStruct) GetBodyBytes() []byte

func (*SSHStruct) GetExitCode added in v0.1.3

func (s *SSHStruct) GetExitCode() int

func (*SSHStruct) GetLastModifiedTime added in v0.5.0

func (s *SSHStruct) GetLastModifiedTime(remoteFile string) (time.Time, error)

func (SSHStruct) GetRemoteDir added in v0.1.2

func (s SSHStruct) GetRemoteDir() string

func (SSHStruct) GetRemoteFileHash added in v0.4.1

func (s SSHStruct) GetRemoteFileHash(path string) (string, error)

func (*SSHStruct) GetRemoteFileSize added in v0.5.3

func (s *SSHStruct) GetRemoteFileSize(remoteFile string) (int64, error)

func (SSHStruct) GetRemoteHostname

func (s SSHStruct) GetRemoteHostname() (string, error)

func (SSHStruct) GetRequest added in v0.4.4

func (s SSHStruct) GetRequest() string

func (SSHStruct) GetSSHCli

func (s SSHStruct) GetSSHCli() string

func (SSHStruct) GetSSHOptionsAsString added in v0.1.3

func (s SSHStruct) GetSSHOptionsAsString() string

func (SSHStruct) GetStderr added in v0.1.2

func (s SSHStruct) GetStderr() string

func (SSHStruct) GetStdout added in v0.1.2

func (s SSHStruct) GetStdout() string

func (SSHStruct) HammerTest added in v0.4.0

func (s SSHStruct) HammerTest() error

func (*SSHStruct) Load added in v0.5.0

func (s *SSHStruct) Load(fileName string) error

func (SSHStruct) MkdirAll added in v0.1.2

func (s SSHStruct) MkdirAll(dir string) error

func (SSHStruct) NotConfigured added in v0.1.2

func (s SSHStruct) NotConfigured() bool

func (SSHStruct) RemoteCapturePid added in v0.1.3

func (s SSHStruct) RemoteCapturePid(jvm string, hint string) (int, error)

func (*SSHStruct) RemoteExecuteAndSpin

func (s *SSHStruct) RemoteExecuteAndSpin(cli string) error

func (SSHStruct) RemoteFileCount added in v0.5.3

func (ssh SSHStruct) RemoteFileCount(sdirectoryPath string, prefix string, glob string) (int, error)

func (SSHStruct) RemoteFileExists

func (s SSHStruct) RemoteFileExists(path string) bool

return false on error or file doesn't exist (easy mode)

func (SSHStruct) RemoteFindFiles added in v0.1.2

func (ssh SSHStruct) RemoteFindFiles(sdirectoryPath string, prefix string, glob string) ([]string, error)

func (SSHStruct) RemoteGetArgsFromPid added in v0.1.3

func (s SSHStruct) RemoteGetArgsFromPid(pid int) ([]string, error)

func (*SSHStruct) RemoteGetRelease added in v0.1.3

func (s *SSHStruct) RemoteGetRelease() int

func (SSHStruct) RemoteGetThreadCount added in v0.1.3

func (s SSHStruct) RemoteGetThreadCount(pid int) (int, error)

func (*SSHStruct) RemoteGetVersion added in v0.1.3

func (s *SSHStruct) RemoteGetVersion() string

func (*SSHStruct) RemoteGit added in v0.1.3

func (s *SSHStruct) RemoteGit(gitargs string) string

func (*SSHStruct) RemoteGitBranch added in v0.1.3

func (s *SSHStruct) RemoteGitBranch() string

func (*SSHStruct) RemoteGitRev added in v0.1.3

func (s *SSHStruct) RemoteGitRev() string

func (*SSHStruct) RemoteJPS added in v0.1.3

func (s *SSHStruct) RemoteJPS() ([]string, error)

func (*SSHStruct) RemotePopenGrep added in v0.1.3

func (s *SSHStruct) RemotePopenGrep(cli string, musthave string, mustnothave string) ([]string, error)

func (*SSHStruct) RemoteReadFile added in v0.1.3

func (s *SSHStruct) RemoteReadFile(f string) error

func (SSHStruct) RemoteRemoveFiles added in v0.1.2

func (ssh SSHStruct) RemoteRemoveFiles(sdirectoryPath string, prefix string, glob string) error

func (*SSHStruct) RemoteTail added in v0.5.0

func (s *SSHStruct) RemoteTail(file string, lines int) ([]string, error)

func (*SSHStruct) RemoveDirAndContent added in v0.1.2

func (s *SSHStruct) RemoveDirAndContent(d string) error

func (SSHStruct) RemoveRemoteDir added in v0.5.0

func (ssh SSHStruct) RemoveRemoteDir(dir string) error

func (SSHStruct) RemoveRemoteFile added in v0.1.2

func (ssh SSHStruct) RemoveRemoteFile(file string) error

func (SSHStruct) RenameRemoteFile added in v0.1.2

func (ssh SSHStruct) RenameRemoteFile(oldfile string, newfile string) error

func (SSHStruct) ReportHammerResults added in v0.4.0

func (s SSHStruct) ReportHammerResults(results []bool, e error) error

func (*SSHStruct) Rsync added in v0.5.0

func (s *SSHStruct) Rsync(source string, target string) error

func (*SSHStruct) RsyncWithSwitches added in v0.5.0

func (s *SSHStruct) RsyncWithSwitches(switches string, source string, target string) error

func (SSHStruct) SecureDownload

func (s SSHStruct) SecureDownload(remoteFilePath string, localFilePath string) error

func (SSHStruct) SecureDownloadAndSpin

func (s SSHStruct) SecureDownloadAndSpin(remoteFilePath string, localFilePath string) error

func (*SSHStruct) SecureRemoteExecution

func (s *SSHStruct) SecureRemoteExecution(cli string) error

func (*SSHStruct) SecureRemotePipeExecution added in v0.1.2

func (s *SSHStruct) SecureRemotePipeExecution(content []byte, cli string) error

func (SSHStruct) SecureUpload

func (s SSHStruct) SecureUpload(localFilePath string, remoteFilePath string) error

func (SSHStruct) SecureUploadAndSpin

func (s SSHStruct) SecureUploadAndSpin(localFilePath string, remoteFilePath string) error

func (*SSHStruct) SecureUploadContent added in v0.1.2

func (s *SSHStruct) SecureUploadContent(content []byte, remoteFilePath string) error

func (*SSHStruct) SecureUploadContent2 added in v0.1.3

func (s *SSHStruct) SecureUploadContent2(content []byte, remoteFilePath string) error

func (*SSHStruct) SetCapture added in v0.1.2

func (s *SSHStruct) SetCapture(c bool) SSHStruct

func (*SSHStruct) SetDefaults

func (ssh *SSHStruct) SetDefaults()

func (*SSHStruct) SetHost added in v0.1.2

func (s *SSHStruct) SetHost(h string) SSHStruct

func (*SSHStruct) SetRemoteDir added in v0.1.2

func (s *SSHStruct) SetRemoteDir(r string) SSHStruct

func (*SSHStruct) SetRequest added in v0.4.4

func (s *SSHStruct) SetRequest(r string)

func (*SSHStruct) SyncFileWithRemote added in v0.5.0

func (s *SSHStruct) SyncFileWithRemote(localFile string, remoteFile string, hashValidation bool, createDirectories bool) error

func (SSHStruct) UploadCLI

func (this SSHStruct) UploadCLI(src string, tgt string) string

local, remote

func (SSHStruct) WithCapture added in v0.1.2

func (s SSHStruct) WithCapture(c bool) SSHStruct

func (SSHStruct) WithHost added in v0.1.2

func (s SSHStruct) WithHost(h string) SSHStruct

func (SSHStruct) WithKey added in v0.1.2

func (s SSHStruct) WithKey(k string) SSHStruct

func (SSHStruct) WithRemoteDir added in v0.1.2

func (s SSHStruct) WithRemoteDir(rd string) SSHStruct

func (SSHStruct) WithRequest added in v0.4.4

func (s SSHStruct) WithRequest(r string) SSHStruct

func (SSHStruct) WithSilent added in v0.1.2

func (s SSHStruct) WithSilent(c bool) SSHStruct

func (SSHStruct) WithUser added in v0.1.2

func (s SSHStruct) WithUser(u string) SSHStruct

func (SSHStruct) WriteSparseFile added in v0.1.2

func (s SSHStruct) WriteSparseFile(f string, sizeMin int, sizeMax int, r int) error

type ServerBuilder added in v0.5.3

type ServerBuilder struct {
	// contains filtered or unexported fields
}

func NewServerBuilder added in v0.5.3

func NewServerBuilder() *ServerBuilder

func (*ServerBuilder) Build added in v0.5.3

func (b *ServerBuilder) Build() *JWTServer

func (*ServerBuilder) WithAddress added in v0.5.3

func (b *ServerBuilder) WithAddress(addr string, port int) *ServerBuilder

func (*ServerBuilder) WithCertificateFiles added in v0.5.3

func (b *ServerBuilder) WithCertificateFiles(cert, key string) *ServerBuilder

func (*ServerBuilder) WithJWTKey added in v0.5.3

func (b *ServerBuilder) WithJWTKey(keyPath string) *ServerBuilder

func (*ServerBuilder) WithLogger added in v0.5.3

func (b *ServerBuilder) WithLogger(logger *log.Logger) *ServerBuilder

func (*ServerBuilder) WithPasscode added in v0.5.3

func (b *ServerBuilder) WithPasscode(passcode string) *ServerBuilder

func (*ServerBuilder) WithSSL added in v0.5.3

func (b *ServerBuilder) WithSSL(cert, key string) *ServerBuilder

func (*ServerBuilder) WithStaticDir added in v0.5.3

func (b *ServerBuilder) WithStaticDir(dir string) *ServerBuilder

func (*ServerBuilder) WithTokenTTL added in v0.5.3

func (b *ServerBuilder) WithTokenTTL(minutes int) *ServerBuilder

type ServerConfig added in v0.5.3

type ServerConfig struct {
	Passcode string
	TokenTTL time.Duration
	CertFile string
	KeyFile  string
	Insecure bool
	Address  string
	Port     int
	// contains filtered or unexported fields
}

type TaskStatusType added in v0.4.0

type TaskStatusType int64
const (
	TSTNone TaskStatusType = iota
	TSTQuened
	TSTRunning
	TSTCompleted
)

func (TaskStatusType) String added in v0.4.0

func (tst TaskStatusType) String() string

type TaskStruct added in v0.4.0

type TaskStruct struct {
	ID          int           `json:"id"`
	Description string        `json:"description"`
	Command     string        `json:"command"`
	Status      string        `json:"status"`
	Output      []string      `json:"output,omitempty"`
	Duration    time.Duration `json:"duration,omitempty"`
	// contains filtered or unexported fields
}

func (*TaskStruct) Init added in v0.4.0

func (ts *TaskStruct) Init()

type TokenType added in v0.4.4

type TokenType struct {
	Token string `json:"token"`
}

type Transition added in v0.4.4

type Transition struct {
	Days         int    `xml:"Days,omitempty"`
	StorageClass string `xml:"StorageClass"`
	Date         string `xml:"Date,omitempty"`
}

Transition represents a transition in a rule

type WatcherCallBackFunc added in v0.1.2

type WatcherCallBackFunc func(*ExecStruct) error

type WebHookStruct added in v0.1.3

type WebHookStruct struct {
	WebHookURL string
}

func (WebHookStruct) SendMsg added in v0.1.3

func (wh WebHookStruct) SendMsg(msg string) error

Directories

Path Synopsis
Example code for alfredo library (c) 2024 C Delezenski <[email protected]>
Example code for alfredo library (c) 2024 C Delezenski <[email protected]>

Jump to

Keyboard shortcuts

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