Documentation
¶
Index ¶
- Constants
- Variables
- func FileDeserializer(filePath string) (outputMap map[string]any, err error)
- func IsStdoutTerminal() bool
- func NewCypherSecretKey() (string, error)
- func ReadServerPrivateIpAddress() (ipAddress tkValueObject.IpAddress, err error)
- func ReadServerPublicIpAddress() (ipAddress tkValueObject.IpAddress, err error)
- func StringDeserializer(serializedString string, serializationFormat string) (outputMap map[string]any, err error)
- func TrustedCidrsReader() (trustedCidrBlocks []tkValueObject.CidrBlock, err error)
- type CertificateSettings
- type Cypher
- type DnsLookup
- type DnsLookupSettings
- type FileAppendSettings
- type FileClerk
- func (clerk FileClerk) AppendFileContent(settings FileAppendSettings, content string) error
- func (clerk FileClerk) CompressDir(sourcePath string, compressionFormatPtr *string) (compressedFilePath string, err error)
- func (clerk FileClerk) CompressFile(sourcePath string, compressionFormatPtr *string, shouldKeepSourceFilePtr *bool) (compressedFilePath string, err error)
- func (clerk FileClerk) CopyDir(sourcePath, targetPath string) error
- func (clerk FileClerk) CopyFile(sourcePath, targetPath string) error
- func (clerk FileClerk) CreateDir(dirPath string) error
- func (clerk FileClerk) CreateSymlink(sourcePath, targetPath string, shouldOverwrite bool) error
- func (clerk FileClerk) DecompressDir(sourcePath string, targetPathPtr *string, shouldKeepSourceFilePtr *bool) (decompressedDirPath string, err error)
- func (clerk FileClerk) DecompressFile(sourcePath string, targetPathPtr *string, shouldKeepSourceFilePtr *bool) (decompressedFilePath string, err error)
- func (FileClerk) DeleteDir(dirPath string) error
- func (FileClerk) DeleteFile(filePath string) error
- func (clerk FileClerk) FileContentRegexReplace(settings FileRegexReplaceSettings, regexPattern *regexp.Regexp, ...) (replacementCount int, err error)
- func (clerk FileClerk) FileContentRegexSearch(filePath tkValueObject.UnixAbsoluteFilePath, regexPattern *regexp.Regexp) (regexSearchFindings []FileContentRegexFindings, err error)
- func (FileClerk) FileExists(filePath string) bool
- func (clerk FileClerk) Find(settings FileFindSettings) (unixFiles []tkEntity.UnixFile, err error)
- func (clerk FileClerk) IsDir(filePath string) bool
- func (clerk FileClerk) IsFile(filePath string) bool
- func (FileClerk) IsSymlink(sourcePath string) bool
- func (clerk FileClerk) IsSymlinkTo(sourcePath, targetPath string) bool
- func (clerk FileClerk) ListDir(settings FileListDirSettings) (unixFiles []tkEntity.UnixFile, err error)
- func (clerk FileClerk) MoveDir(sourcePath, targetPath string) error
- func (clerk FileClerk) MoveFile(sourcePath, targetPath string) error
- func (clerk FileClerk) OverwriteFile(sourcePath, targetPath string) error
- func (clerk FileClerk) ReadFileContent(filePath string, maxContentSizeBytesPtr *int64) (fileContent string, err error)
- func (FileClerk) RemoveSymlink(symlinkPath string) error
- func (FileClerk) TempFileNameFactory(targetFileName tkValueObject.UnixFileName) string
- func (clerk FileClerk) TempFilePathFactory(targetFilePath tkValueObject.UnixAbsoluteFilePath) (string, error)
- func (FileClerk) TouchFile(filePath string) error
- func (FileClerk) TruncateFileContent(filePath tkValueObject.UnixAbsoluteFilePath) error
- func (clerk FileClerk) UpdateFileOwnership(filePath string, userId, groupId int) error
- func (FileClerk) UpdateFilePermissions(filePath string, permissionsPtr *os.FileMode) error
- func (clerk FileClerk) UpsertFile(settings FileUpsertSettings, fileContent []byte) error
- func (clerk FileClerk) WriteNewFile(filePath, content string, permissions os.FileMode) error
- type FileClerkDirChainPolicy
- type FileClerkOverwritePolicy
- type FileClerkOwnerSource
- type FileClerkSymlinkPolicy
- type FileContentRegexFindings
- type FileFindSettings
- type FileListDirSettings
- type FileRegexReplaceSettings
- type FileUpsertSettings
- type PrivateKeySettings
- type PublicIpAddressResolver
- type ReadThrough
- type Shell
- type ShellError
- type ShellEscape
- type ShellSettings
- type Synthesizer
- func (synth *Synthesizer) CACertificatePemFactory(settings CertificateSettings) (certPem string, keyPem string, err error)
- func (synth *Synthesizer) CertificatePemFactory(settings CertificateSettings) (certPem string, keyPem string, err error)
- func (synth *Synthesizer) CharsetPresenceGuarantor(originalString []byte, charset string) []byte
- func (synth *Synthesizer) MailAddressFactory(username *string) string
- func (synth *Synthesizer) PasswordFactory(desiredLength int, shouldIncludeSymbols bool) string
- func (synth *Synthesizer) PrivateKeyPemFactory(settings PrivateKeySettings) (keyPem string, err error)
- func (synth *Synthesizer) RandomIntegerGenerator(lowestValue, highestValue int) int
- func (synth *Synthesizer) SelfSignedCertificatePairFactory(commonName *tkValueObject.Fqdn, altNames []tkValueObject.Fqdn) (certPair tls.Certificate, err error)
- func (synth *Synthesizer) SelfSignedCertificatePairPemFactory(commonName *tkValueObject.Fqdn, altNames []tkValueObject.Fqdn) (certPem string, keyPem string, err error)
- func (synth *Synthesizer) UsernameFactory() string
Constants ¶
const ( SerializationFormatJson = "json" SerializationFormatYaml = "yaml" )
const ( ReadThroughCertPairCertPathEnvVarName string = "CERTIFICATE_PAIR_CERT_PATH" ReadThroughCertPairKeyPathEnvVarName string = "CERTIFICATE_PAIR_KEY_PATH" ReadThroughPkiDirEnvVarName string = "PKI_DIR" )
const ( ShellExecutionTimeoutDefaultSecs uint64 = 1800 ShellExecutionTimeoutGraceSecs uint64 = 10 ShellCommandTimeoutExitCode int = 124 )
const ( CharsetLowercaseLetters string = "abcdefghijklmnopqrstuvwxyz" CharsetUppercaseLetters string = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" CharsetNumbers string = "0123456789" CharsetSymbols string = "!@#$%^&*()_+" )
const ( TrustedIpsEnvVarName string = "TRUSTED_IPS" TrustedCidrsEnvVarName string = "TRUSTED_CIDRS" )
const CypherNewSecretKeyLength = 32
const (
ServerPublicIpAddressEnvVarName string = "SERVER_PUBLIC_IP_ADDR"
)
Variables ¶
var ( ErrDnsLookupResponseIdMismatch = errors.New("DnsLookupResponseIdMismatch") ErrDnsLookupResponseNotResponse = errors.New("DnsLookupResponseNotResponse") ErrDnsLookupResponseQuestionMismatch = errors.New("DnsLookupResponseQuestionMismatch") ErrDnsLookupResponseNameError = errors.New("DnsLookupResponseNameError") ErrDnsLookupResponseServerFailure = errors.New("DnsLookupResponseServerFailure") ErrDnsLookupResponseRefused = errors.New("DnsLookupResponseRefused") ErrDnsLookupResponseUnknownRCode = errors.New("DnsLookupResponseUnknownRCode") ErrDnsLookupResponseTruncated = errors.New("DnsLookupResponseTruncated") )
var ( RegexLargeFileThresholdBytes int64 = 10 * 1024 * 1024 ReadFileContentDefaultMaxSizeBytes int64 = 500 * 1024 * 1024 FileClerkDefaultNewFileMode os.FileMode = 0o600 FileClerkDefaultMaxFiles uint64 = 1000 FileClerkSymlinkPolicyStrictRefuse FileClerkSymlinkPolicy = "strict-refuse" FileClerkSymlinkPolicyResolve FileClerkSymlinkPolicy = "resolve" FileClerkDirChainPolicySharedWriteAllowed FileClerkDirChainPolicy = "shared-write-allowed" // is writable by group or others. A sticky component is allowed. The // rejection fails with ErrDirectoryWritableByOthers. FileClerkDirChainPolicySharedWriteRefused FileClerkDirChainPolicy = "shared-write-refused" FileClerkOverwritePolicyStrictRefuse FileClerkOverwritePolicy = "strict-refuse" FileClerkOverwritePolicyReplace FileClerkOverwritePolicy = "replace" FileClerkOwnerSourceExistingFile FileClerkOwnerSource = "existing-file" FileClerkOwnerSourceContainingDirectory FileClerkOwnerSource = "containing-directory" FileClerkOwnerSourceRunningProcess FileClerkOwnerSource = "running-process" ErrSourceFileMissing = errors.New("SourceFileNotFound") ErrTargetFileExists = errors.New("TargetFileAlreadyExists") ErrFileMissing = errors.New("FileNotFound") ErrDirMissing = errors.New("DirNotFound") ErrGlobPatternInvalid = errors.New("GlobPatternInvalid") ErrStartingPathMissing = errors.New("StartingPathOrPatternMustBeSet") ErrStartingPathConflict = errors.New("StartingPathConflictsWithStartingPathPattern") ErrFileEmpty = errors.New("FileEmpty") ErrReplacementWouldTruncateFile = errors.New("ReplacementWouldTruncateFile") ErrDirCompressionWrongFormat = errors.New("DirectoryCompressionMustUseTarFormat") ErrCompressedFileMissing = errors.New("CompressedFileNotFound") ErrSourceDirMissing = errors.New("SourceDirNotFound") ErrTargetDirExists = errors.New("TargetDirAlreadyExists") ErrSourcePathMissing = errors.New("SourcePathNotFound") ErrSymlinkExists = errors.New("SymlinkAlreadyExists") ErrTargetPathExists = errors.New("TargetPathAlreadyExists") ErrRegexPatternMissing = errors.New("RegexPatternCannotBeNil") ErrUnsupportedCompressionFormat = errors.New("UnsupportedCompressionFormat") ErrTargetIsDirectory = errors.New("TargetIsDirectory") ErrSourceIsDirectory = errors.New("SourceIsDirectory") ErrFileTooLarge = errors.New("FileTooLarge") ErrTargetIsSymlink = errors.New("TargetIsSymlink") ErrTargetNotDirectory = errors.New("TargetNotDirectory") ErrTargetNotRegularFile = errors.New("TargetNotRegularFile") ErrDirPathTraversalInvalid = errors.New("DirPathParentTraversalNotAllowed") ErrSymlinkedPathInvalid = errors.New("PathComponentIsSymlink") ErrDirectoryOwnerInvalid = errors.New("DirectoryNotOwnedByExpectedOwner") ErrDirectoryWritableByOthers = errors.New("DirectoryWritableByOthers") ErrFileNameInvalid = errors.New("FilePathFinalComponentIsNotAFileName") ErrTempFileNameTooLong = errors.New("TempFileNameExceedsNameMax") ErrDirChainPolicyInvalid = errors.New("DirChainPolicyInvalid") ErrSymlinkPolicyInvalid = errors.New("SymlinkPolicyInvalid") ErrOverwritePolicyInvalid = errors.New("OverwritePolicyInvalid") ErrOwnerSourceInvalid = errors.New("OwnerSourceInvalid") ErrOwnerSourceConflict = errors.New("OwnerSourceConflictsWithStatedOwner") ErrFileOwnerChangeFailed = errors.New("FileOwnerChangeFailed") ErrTargetFileChanged = errors.New("TargetFileChanged") )
Functions ¶
func FileDeserializer ¶ added in v0.0.2
func IsStdoutTerminal ¶ added in v0.3.3
func IsStdoutTerminal() bool
IsStdoutTerminal is the single interactivity check shared by the CLI logger and response renderer. Both honor one contract: logs go to stderr, stdout carries the JSON response only, and a human at a terminal gets richer formatting. Both sides must agree or the response channel corrupts.
func NewCypherSecretKey ¶ added in v0.1.7
NewCypherSecretKey generates a cryptographically secure random 32-byte secret key, encodes it in base64 for safe storage and transmission, and returns it as a string. This key is suitable for AES-GCM encryption and should be kept confidential.
func ReadServerPrivateIpAddress ¶ added in v0.0.6
func ReadServerPrivateIpAddress() (ipAddress tkValueObject.IpAddress, err error)
func ReadServerPublicIpAddress ¶ added in v0.0.6
func ReadServerPublicIpAddress() (ipAddress tkValueObject.IpAddress, err error)
func StringDeserializer ¶ added in v0.0.2
func TrustedCidrsReader ¶ added in v0.2.7
func TrustedCidrsReader() (trustedCidrBlocks []tkValueObject.CidrBlock, err error)
Types ¶
type CertificateSettings ¶ added in v0.2.0
type CertificateSettings struct {
CommonName *tkValueObject.Fqdn
AltNames []tkValueObject.Fqdn
IsCA bool
MaxPathLengthPtr *int
HasMaxPathLengthZero bool
}
type Cypher ¶ added in v0.1.7
type Cypher struct {
// contains filtered or unexported fields
}
func NewCypher ¶ added in v0.1.7
NewCypher creates a new Cypher instance with the provided base64-encoded secret key. The key must be a valid base64 string that decodes to exactly 16, 24, or 32 bytes for AES encryption. Use NewCypherSecretKey to generate a suitable key if needed. Returns an error if the key is invalid, providing fail-fast validation.
type DnsLookup ¶ added in v0.1.8
type DnsLookup struct {
// contains filtered or unexported fields
}
func NewDnsLookup ¶ added in v0.1.8
func NewDnsLookup(settings DnsLookupSettings) *DnsLookup
func (*DnsLookup) Execute ¶ added in v0.1.8
func (lookup *DnsLookup) Execute( hostname tkValueObject.UnixHostname, recordType *tkValueObject.DnsRecordType, ) ([]string, error)
type DnsLookupSettings ¶ added in v0.2.9
type DnsLookupSettings struct {
PrimaryResolver tkValueObject.IpAddress
SecondaryResolver tkValueObject.IpAddress
QueryTimeoutSecs uint
DialTimeoutMs uint
ShouldBypassLocalResolver bool
}
type FileAppendSettings ¶ added in v0.3.5
type FileAppendSettings struct {
FilePath tkValueObject.UnixAbsoluteFilePath
DirChainPolicy *FileClerkDirChainPolicy
SymlinkPolicy *FileClerkSymlinkPolicy
// When empty, the running process account is trusted. Root is
// always trusted.
TrustedDirOwnerUsernames []tkValueObject.UnixUsername
TrustedDirOwnerUserIds []tkValueObject.UnixUserId
}
type FileClerk ¶ added in v0.0.7
type FileClerk struct{}
func (FileClerk) AppendFileContent ¶ added in v0.3.4
func (clerk FileClerk) AppendFileContent( settings FileAppendSettings, content string, ) error
AppendFileContent appends through an O_APPEND write, so concurrent writers never lose data. The target keeps its owner, group, and mode. A swap during the append fails with ErrTargetFileChanged. A missing target fails with ErrFileMissing. Create it with UpsertFile. Symlinks are refused unless the policy resolves them.
func (FileClerk) CompressDir ¶ added in v0.0.7
func (FileClerk) CompressFile ¶ added in v0.0.7
func (FileClerk) CreateSymlink ¶ added in v0.0.7
func (FileClerk) DecompressDir ¶ added in v0.0.7
func (FileClerk) DecompressFile ¶ added in v0.0.7
func (clerk FileClerk) DecompressFile( sourcePath string, targetPathPtr *string, shouldKeepSourceFilePtr *bool, ) (decompressedFilePath string, err error)
DecompressFile expands sourcePath and removes the archive unless shouldKeepSourceFilePtr requests otherwise. Zip extraction overwrites existing files without warning. Only decompress archives you trust.
func (FileClerk) DeleteFile ¶ added in v0.0.7
func (FileClerk) FileContentRegexReplace ¶ added in v0.3.0
func (clerk FileClerk) FileContentRegexReplace( settings FileRegexReplaceSettings, regexPattern *regexp.Regexp, replacement string, ) (replacementCount int, err error)
FileContentRegexReplace atomically substitutes regex matches. The target keeps its owner, group, and mode, including special bits. A swap during the operation fails with ErrTargetFileChanged. Symlinks are refused unless the policy resolves them. A zero-byte result fails with ErrReplacementWouldTruncateFile. Use TruncateFileContent to empty a file. Files at or above the large-file threshold stream line by line, so a multi-line pattern needs a smaller file.
func (FileClerk) FileContentRegexSearch ¶ added in v0.2.9
func (clerk FileClerk) FileContentRegexSearch( filePath tkValueObject.UnixAbsoluteFilePath, regexPattern *regexp.Regexp, ) (regexSearchFindings []FileContentRegexFindings, err error)
FileContentRegexSearch finds every regex match in a file. Each result has capture groups and a 1-based inclusive line range. Use the (?m) flag for per-line anchors. Files at or above RegexLargeFileThresholdBytes stream line by line, so a multi-line pattern matches within one line only.
func (FileClerk) FileExists ¶ added in v0.0.7
func (FileClerk) Find ¶ added in v0.4.0
func (clerk FileClerk) Find( settings FileFindSettings, ) (unixFiles []tkEntity.UnixFile, err error)
Find walks every directory that StartingPath or StartingPathPattern matches. It returns UnixFile entities sorted by path. The starting directory is not in the results. Exactly one of the two starting points must be set. A missing starting path fails with ErrDirMissing. A wildcard that matches nothing returns an empty result. Non-directories are skipped. A wildcard match that cannot be read is skipped with a warning. A directly named path fails with its read error. NamePattern matches the entry name. A nil NamePattern matches every entry. MaxFiles 0 reads without a cap. The cap counts across all matched starting directories. An unreadable entry is skipped with a warning. A subdirectory replaced mid-walk fails with ErrTargetFileChanged.
func (FileClerk) IsSymlinkTo ¶ added in v0.0.7
func (FileClerk) ListDir ¶ added in v0.4.0
func (clerk FileClerk) ListDir( settings FileListDirSettings, ) (unixFiles []tkEntity.UnixFile, err error)
ListDir reads a directory tree into UnixFile entities sorted by entry name. The path breaks ties. MaxDepth 0 reads only the root's entries. MaxDepth N reads N levels of subdirectories. MaxFiles 0 reads without a cap. A small MaxFiles truncates silently. An unreadable entry is skipped with a warning. A subdirectory replaced mid-walk fails with ErrTargetFileChanged.
func (FileClerk) MoveFile ¶ added in v0.0.7
MoveFile never replaces an existing target. Cross-device moves fall back to copy and delete. An interrupted run leaves a partial target next to an untouched source.
func (FileClerk) OverwriteFile ¶ added in v0.3.0
OverwriteFile atomically replaces the underlying file of targetPath with the content of sourcePath. Symlink targets are written through. The original file and every other reference stay in place.
func (FileClerk) ReadFileContent ¶ added in v0.0.7
func (FileClerk) RemoveSymlink ¶ added in v0.0.7
func (FileClerk) TempFileNameFactory ¶ added in v0.3.4
func (FileClerk) TempFileNameFactory( targetFileName tkValueObject.UnixFileName, ) string
func (FileClerk) TempFilePathFactory ¶ added in v0.3.4
func (clerk FileClerk) TempFilePathFactory( targetFilePath tkValueObject.UnixAbsoluteFilePath, ) (string, error)
func (FileClerk) TouchFile ¶ added in v0.3.3
TouchFile behaves like touch(1). A dangling symlink fails with ErrTargetIsSymlink instead of creating the file behind the link.
func (FileClerk) TruncateFileContent ¶ added in v0.0.7
func (FileClerk) TruncateFileContent( filePath tkValueObject.UnixAbsoluteFilePath, ) error
func (FileClerk) UpdateFileOwnership ¶ added in v0.0.7
func (FileClerk) UpdateFilePermissions ¶ added in v0.0.7
UpdateFilePermissions never chmods through a symlink. Unlike chmod(2), it requires read permission on the target. Root is exempt.
func (FileClerk) UpsertFile ¶ added in v0.3.4
func (clerk FileClerk) UpsertFile( settings FileUpsertSettings, fileContent []byte, ) error
type FileClerkDirChainPolicy ¶ added in v0.3.5
type FileClerkDirChainPolicy string
FileClerkDirChainPolicy selects how the directory-chain walk treats a component writable by group or others.
type FileClerkOverwritePolicy ¶ added in v0.3.5
type FileClerkOverwritePolicy string
type FileClerkOwnerSource ¶ added in v0.3.5
type FileClerkOwnerSource string
type FileClerkSymlinkPolicy ¶ added in v0.3.5
type FileClerkSymlinkPolicy string
type FileContentRegexFindings ¶ added in v0.3.0
FileContentRegexFindings holds one regex match and its capture groups. LineNumRange is [start, end] inclusive. A single-line match has start == end.
type FileFindSettings ¶ added in v0.4.0
type FileFindSettings struct {
StartingPath tkValueObject.UnixAbsoluteFilePath
StartingPathPattern tkValueObject.UnixAbsoluteGlobPath
MaxDepth uint16
DirChainPolicy *FileClerkDirChainPolicy
SymlinkPolicy *FileClerkSymlinkPolicy
TrustedDirOwnerUsernames []tkValueObject.UnixUsername
TrustedDirOwnerUserIds []tkValueObject.UnixUserId
MaxFiles *uint64
NamePattern *regexp.Regexp
}
type FileListDirSettings ¶ added in v0.4.0
type FileListDirSettings struct {
DirPath tkValueObject.UnixAbsoluteFilePath
MaxDepth uint16
DirChainPolicy *FileClerkDirChainPolicy
SymlinkPolicy *FileClerkSymlinkPolicy
TrustedDirOwnerUsernames []tkValueObject.UnixUsername
TrustedDirOwnerUserIds []tkValueObject.UnixUserId
MaxFiles *uint64
}
type FileRegexReplaceSettings ¶ added in v0.3.5
type FileRegexReplaceSettings struct {
FilePath tkValueObject.UnixAbsoluteFilePath
DirChainPolicy *FileClerkDirChainPolicy
SymlinkPolicy *FileClerkSymlinkPolicy
// When empty, the running process account is trusted. Root is
// always trusted.
TrustedDirOwnerUsernames []tkValueObject.UnixUsername
TrustedDirOwnerUserIds []tkValueObject.UnixUserId
}
type FileUpsertSettings ¶ added in v0.3.4
type FileUpsertSettings struct {
FilePath tkValueObject.UnixAbsoluteFilePath
DirChainPolicy *FileClerkDirChainPolicy
OverwritePolicy *FileClerkOverwritePolicy
SymlinkPolicy *FileClerkSymlinkPolicy
// When empty, the running process account is trusted. Root is
// always trusted.
TrustedDirOwnerUsernames []tkValueObject.UnixUsername
TrustedDirOwnerUserIds []tkValueObject.UnixUserId
Permissions *os.FileMode
OwnerSource *FileClerkOwnerSource
OwnerUsername *tkValueObject.UnixUsername
OwnerUserId *tkValueObject.UnixUserId
OwnerGroupId *tkValueObject.UnixGroupId
}
type PrivateKeySettings ¶ added in v0.2.0
type PrivateKeySettings struct {
Algorithm tkValueObject.PrivateKeyAlgorithm
BitSize int
}
type PublicIpAddressResolver ¶ added in v0.2.9
type PublicIpAddressResolver struct {
// contains filtered or unexported fields
}
func NewPublicIpAddressResolver ¶ added in v0.2.9
func NewPublicIpAddressResolver() *PublicIpAddressResolver
func (*PublicIpAddressResolver) Resolve ¶ added in v0.2.9
func (resolver *PublicIpAddressResolver) Resolve() ( ipAddress tkValueObject.IpAddress, err error, )
type ReadThrough ¶ added in v0.1.0
type ReadThrough struct {
}
Provides methods for reading information that when not found, are generated on the fly.
func (*ReadThrough) CertPairFilePathsReader ¶ added in v0.1.0
func (rt *ReadThrough) CertPairFilePathsReader() ( certPath tkValueObject.UnixAbsoluteFilePath, keyPath tkValueObject.UnixAbsoluteFilePath, err error, )
Attempts to retrieve the certificate pair file paths from the environment variables "CERTIFICATE_PAIR_CERT_PATH" and "CERTIFICATE_PAIR_KEY_PATH", otherwise generates a self-signed certificate pair on local 'pki' directory (or the directory specified by the environment variable "PKI_DIR") and returns the absolute paths to the generated files.
type Shell ¶ added in v0.0.6
type Shell struct {
// contains filtered or unexported fields
}
func NewShell ¶ added in v0.0.6
func NewShell(settings ShellSettings) Shell
NewShell returns a value, not a pointer. Run copies the settings per call, so the sub-shell rewrite during preparation never compounds. A pointer receiver was rejected: it would leak that rewrite across calls and double-wrap the command on the second Run.
type ShellError ¶ added in v0.0.6
func (*ShellError) Error ¶ added in v0.0.6
func (e *ShellError) Error() string
type ShellEscape ¶ added in v0.0.7
type ShellEscape struct {
}
func (ShellEscape) Quote ¶ added in v0.0.7
func (ShellEscape) Quote(inputStr string) string
func (ShellEscape) StripUnsafe ¶ added in v0.0.7
func (ShellEscape) StripUnsafe(inputStr string) string
type ShellSettings ¶ added in v0.0.6
type ShellSettings struct {
Command string
Args []string
ShouldUseSubShell bool
ShouldUseCleanEnv bool
ShouldDisableTimeout bool
ShouldIgnoreUsernameLookupError bool
Username string
UserId *uint32
WorkingDirectory string
ExecutionTimeoutSecs uint64
ExecutionDeadline *tkValueObject.UnixTime
Envs []string
StdoutFilePath string
StderrFilePath string
}
type Synthesizer ¶
type Synthesizer struct{}
func (*Synthesizer) CACertificatePemFactory ¶ added in v0.2.0
func (synth *Synthesizer) CACertificatePemFactory( settings CertificateSettings, ) (certPem string, keyPem string, err error)
func (*Synthesizer) CertificatePemFactory ¶ added in v0.2.0
func (synth *Synthesizer) CertificatePemFactory( settings CertificateSettings, ) (certPem string, keyPem string, err error)
func (*Synthesizer) CharsetPresenceGuarantor ¶
func (synth *Synthesizer) CharsetPresenceGuarantor( originalString []byte, charset string, ) []byte
func (*Synthesizer) MailAddressFactory ¶
func (synth *Synthesizer) MailAddressFactory(username *string) string
func (*Synthesizer) PasswordFactory ¶
func (synth *Synthesizer) PasswordFactory( desiredLength int, shouldIncludeSymbols bool, ) string
func (*Synthesizer) PrivateKeyPemFactory ¶ added in v0.2.0
func (synth *Synthesizer) PrivateKeyPemFactory( settings PrivateKeySettings, ) (keyPem string, err error)
func (*Synthesizer) RandomIntegerGenerator ¶ added in v0.3.4
func (synth *Synthesizer) RandomIntegerGenerator( lowestValue, highestValue int, ) int
func (*Synthesizer) SelfSignedCertificatePairFactory ¶ added in v0.1.0
func (synth *Synthesizer) SelfSignedCertificatePairFactory( commonName *tkValueObject.Fqdn, altNames []tkValueObject.Fqdn, ) (certPair tls.Certificate, err error)
func (*Synthesizer) SelfSignedCertificatePairPemFactory ¶ added in v0.1.0
func (synth *Synthesizer) SelfSignedCertificatePairPemFactory( commonName *tkValueObject.Fqdn, altNames []tkValueObject.Fqdn, ) (certPem string, keyPem string, err error)
func (*Synthesizer) UsernameFactory ¶
func (synth *Synthesizer) UsernameFactory() string