Documentation
¶
Index ¶
- func CleanAndValidateHost(host string) (string, error)
- func ContainsExactlyOneInterpolationMarker(s string) bool
- func DecodePrivateKey(keyData string) (*rsa.PrivateKey, error)
- func EnsureSuffix(s, suffix string) string
- func ExtractRepoName(gitURL string) (string, error)
- func FileExists(filename string) bool
- func FindFiles(rootDir string, pattern string) ([]string, error)
- func FindFilesWithExclusions(rootDir string, pattern string, excludeDirs []string) ([]string, error)
- func FromPtr[T any](p *T) T
- func GenerateGithubJWT(appID int64, privateKey *rsa.PrivateKey) (string, error)
- func GenerateRandomSimpleID(length int) (string, error)
- func GenerateSecurePassword(length int, simple bool) (string, error)
- func GenerateSlug(displayName string) (string, error)
- func GenerateSubdomain(name, externalURL string) (string, error)
- func GetExposedPortsFromRegistry(imageName string) ([]string, error)
- func GetIPAddress(r *http.Request) string
- func InferOperatorPVCMountPath(databaseType string) *string
- func IsTextFile(path string) bool
- func IsValidGlobPattern(pattern string) bool
- func IsValidUnixPath(path string) bool
- func JoinURLPaths(baseURL string, paths ...string) (string, error)
- func MatchesGlobPattern(value, pattern string) bool
- func ReadFile(path string) (string, error)
- func ReadFileWithLimit(path string, maxSizeBytes int64) (string, error)
- func SafeReadFile(path string) (string, bool)
- func ToPtr[T any](v T) *T
- func ValidateAndExtractDomain(urlStr string) (string, error)
- func ValidateCronExpression(cron string) error
- func ValidateStorageQuantity(s string) (resource.Quantity, error)
- func ValidateStorageQuantityGB(sizeGB float64) (resource.Quantity, error)
- type DNSChecker
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CleanAndValidateHost ¶
CleanAndValidateHost takes a host string and returns a cleaned version with protocol removed and ensures it's a valid domain. Returns an error if the host is invalid.
func ContainsExactlyOneInterpolationMarker ¶
Makes sure a string contains one interpolation marker, ${} , allow escaping to ignore
func DecodePrivateKey ¶
func DecodePrivateKey(keyData string) (*rsa.PrivateKey, error)
func EnsureSuffix ¶
func ExtractRepoName ¶
func FindFiles ¶
FindFiles recursively searches for files in rootDir that match the provided pattern. Pattern uses the same syntax as filepath.Match (e.g., "*.go", "config.*").
func FindFilesWithExclusions ¶
func FindFilesWithExclusions(rootDir string, pattern string, excludeDirs []string) ([]string, error)
FindFilesWithExclusions is like FindFiles but allows excluding certain directories or patterns
func GenerateGithubJWT ¶
func GenerateGithubJWT(appID int64, privateKey *rsa.PrivateKey) (string, error)
Generate JWT to authenticate with github APIs
func GenerateRandomSimpleID ¶
func GenerateSecurePassword ¶
GenerateSecurePassword creates a password with the required constraints
func GenerateSlug ¶
func GenerateSubdomain ¶
Generate a default subdomain
func GetExposedPortsFromRegistry ¶
GetexportedPortsFromRegistry detects exposed ports from a docker manifest, in 8080/tcp format
func GetIPAddress ¶
func InferOperatorPVCMountPath ¶
InferOperatorPVCMountPath infers the mount path for a PVC based on the operator type (database)
func IsTextFile ¶
IsTextFile checks if a file appears to be a text file rather than binary
func IsValidGlobPattern ¶
IsValidGlobPattern checks if a string is a valid glob pattern
func IsValidUnixPath ¶
IsValidUnixPath checks if the given path is a valid Unix-style path. A valid Unix path: - Starts with a forward slash (/) - Contains only forward slashes as separators - Does not contain Windows-style backslashes - Does not contain invalid characters
func MatchesGlobPattern ¶
MatchesGlobPattern checks if a value matches a glob pattern
func ReadFile ¶
ReadFile reads the content of a file at the given path and returns it as a string. It handles potential errors and has a configurable maximum file size.
func ReadFileWithLimit ¶
ReadFileWithLimit reads file content with a specified size limit
func SafeReadFile ¶
SafeReadFile attempts to read a file with proper error handling and defaults
func ValidateAndExtractDomain ¶
ValidateAndExtractDomain takes a URL string and: 1. Validates if it's a proper URL (must start with http:// or https://) 2. Extracts the domain name 3. Converts special characters to hyphens Returns the transformed domain and an error if invalid
func ValidateCronExpression ¶
ValidateCronExpression validates a cron expression string. It checks if the expression follows the standard cron format: minute hour day month weekday Returns an error if the expression is invalid, nil if valid.
func ValidateStorageQuantity ¶
validateStorageQuantity returns the parsed Quantity or an error if the string isn’t a whole-byte storage unit.
Types ¶
type DNSChecker ¶
type DNSChecker struct {
// contains filtered or unexported fields
}
DNSChecker provides methods to check DNS and Cloudflare proxy status
func NewDNSChecker ¶
func NewDNSChecker() *DNSChecker
NewDNSChecker creates a new DNSChecker instance with default settings
func (*DNSChecker) IsPointingToIP ¶
func (self *DNSChecker) IsPointingToIP(domain string, expectedIP string) (bool, error)
IsPointingToIP checks if a domain is pointing to a specific IP address
func (*DNSChecker) IsUsingCloudflareProxy ¶
func (self *DNSChecker) IsUsingCloudflareProxy(domain string) (bool, error)
IsUsingCloudflareProxy checks if a domain is using Cloudflare proxy