Documentation ¶
Index ¶
- Constants
- Variables
- func AddMaps(maps ...map[string]string) map[string]string
- func AddStringSliceUniques(ss []string, add []string) []string
- func CamelCase(s string) string
- func CapitalizeMessage(msg string) string
- func ContainerVersionParse(version string) (*time.Time, error)
- func ConvertPEMtoOpenSSH(pemStr string) (string, error)
- func CopyStringMap(srcM map[string]string) map[string]string
- func DNSSanitize(name string) string
- func DockerSanitize(name string) string
- func EscapeJson(jsoninput string) string
- func EscapeLDAPName(name string) string
- func GetEpochMillis(t time.Time) int64
- func GetExternalApiAddr(defaultApiAddr string) (string, error)
- func GetHeadersString(header http.Header) string
- func GetShardIndex(key interface{}, numShards uint) uint64
- func GetWaitTime(now time.Time, intervalSec, offsetSec float64) time.Duration
- func HeatSanitize(name string) string
- func HostnameSanitize(name string) string
- func ImagePathParse(imagepath string) (*url.URL, error)
- func IsLatitudeValid(latitude float64) bool
- func IsLongitudeValid(longitude float64) bool
- func K8SLabelValueSanitize(label string) string
- func K8SSanitize(name string) string
- func K8SServiceSanitize(name string) string
- func MapsEqual(a, b map[string]string) bool
- func NamespaceSanitize(name string) string
- func OpenUrl(url string) error
- func QuoteArgs(cmd string) (string, error)
- func RandAscii(n int) []byte
- func RemoveExtension(path string) string
- func RemoveStringSliceUniques(ss []string, rm []string) []string
- func ResolveExternalAddr() (string, error)
- func SetExtension(path, extension string) string
- func SplitCamelCase(name string) []string
- func StringSliceCopy(a []string) []string
- func StringSliceEqual(a, b []string) bool
- func TimeFromEpochMicros(us int64) time.Time
- func TrimScheme(addr string) string
- func UnCamelCase(name string) string
- func UncapitalizeMessage(msg string) string
- func UnescapeLDAPName(name string) string
- func ValidCliArg(arg string) bool
- func ValidDNSName(name string) error
- func ValidDockerName(name string) bool
- func ValidEmail(email string) bool
- func ValidIp(ip []byte) bool
- func ValidK8SContainerName(name string) error
- func ValidKubernetesName(name string) bool
- func ValidLDAPName(name string) error
- func ValidName(name string) bool
- func ValidObjName(name string) error
- func ValidRegion(name string) bool
- func ValidStoragePath(path string) error
- func ValidateImagePath(imagePath string) error
- func ValidateImageVersion(imgVersion string) error
- func ValidateNames(names map[string]string) error
- func ValidatePublicKey(pemStr string) (*rsa.PublicKey, error)
- type EmptyStringJsonNumber
- type FormUrlEncodedClearer
- type JSONRedactor
- type Mutex
- type PortSpec
Constants ¶
const ( UpdateListActionAdd = "add" UpdateListActionRemove = "remove" UpdateListActionReplace = "replace" )
const EmptySet = "empty"
Name to clear map/list for CLI
Variables ¶
var MaxK8sUdpPorts int = 1000
Functions ¶
func AddStringSliceUniques ¶
func CapitalizeMessage ¶
func ConvertPEMtoOpenSSH ¶
func CopyStringMap ¶
Make a copy of a string map if the source map is nil, the result is an empty map
func DNSSanitize ¶
DNSSanitize santizies the name string for RFC 1123 DNS format. Valid chars are only 0-9, a-z, and '-' and cannot start or end in '-'
func DockerSanitize ¶
DockerSanitize sanitizes the name string (which is assumed to be a ValidName) to make it usable as a docker image name (no spaces and special chars other than - and . are allowed)
func EscapeJson ¶
func EscapeLDAPName ¶
func GetEpochMillis ¶
Get the number of milliseconds since epoch for the time. This is used for ElasticSearch.
func GetExternalApiAddr ¶
Get the external address with port when running under kubernetes. This allows horizontally scaled instances to talk to each other within a given k8s cluster.
func GetHeadersString ¶
func GetShardIndex ¶
Get the shard index based on the key and number of shards.
func GetWaitTime ¶
Get the time to wait based on the interval and offset. Intervals start at epoch time zero. Returns the time to wait until the next interval time. For example, if intervals are every 10 seconds, then triggers are at time 10,20,30,40,... If time is now 5, it is 5 seconds until trigger 10. If time is now 99, it is 1 second until trigger 100.
The intent is that the stats senders send stats more-or-less around the same time, and the aggregator processes those stats at the same interval, but some offset later, allowing the aggregator to receive stats from all senders for the current interval before processing. This assumes loose time synchronization between nodes in the system where the offset can compensate for differences in time synchronization.
func HeatSanitize ¶
alphanumeric plus -_. first char must be alpha, <= 255 chars.
func HostnameSanitize ¶
HostnameSanitize makes a valid hostname, for which the rules are the same as DNSSanitize, but it cannot end in '-' and cannot be > 63 digits
func IsLatitudeValid ¶
IsLatitudeValid checks that the latitude is within accepted ranges
func IsLongitudeValid ¶
IsLongitudeValid checks that the longitude is within accepted ranges
func K8SLabelValueSanitize ¶
K8SLabelValueSanitize sanitizes a string to use as a metadata label value Label values must be 63 chars or less (can be empty), must begin and end with alphanumerics [a-z0-9A-Z], and may contain dashes, underscores, dots, and alphanumerics.
func K8SSanitize ¶
func K8SServiceSanitize ¶
func NamespaceSanitize ¶
Namespaces are limited to 63 characters and cannot end in "-"
func RemoveExtension ¶
RemoveExtension removes extension and all trailing dots after a filename. Nothing will be trimmed if no filename is detected. This behavior is different from strings.TrimSuffix(path, filepath.Ext(path)), which will trim any extension and trailing dot regardless of the filename, i.e. ".." will become ".".
func ResolveExternalAddr ¶
This is for figuring out the "external" address when running under kubernetes, which is really the internal CNI address that containers can use to talk to each other.
func SetExtension ¶
SetExtension adds an extension to path if the basename of path has a filename. It will replace any existing extension.
func SplitCamelCase ¶
func StringSliceCopy ¶
func StringSliceEqual ¶
func TimeFromEpochMicros ¶
func TrimScheme ¶
func UnCamelCase ¶
UnCamelCase converts camel case to lowercase separated by underscore
func UncapitalizeMessage ¶
func UnescapeLDAPName ¶
func ValidCliArg ¶
Valid CLI args must be all lowercase, and my only contain alphanumeric and period, and in the case of repeated objects, colons.
func ValidDNSName ¶
func ValidDockerName ¶
func ValidEmail ¶
func ValidK8SContainerName ¶
func ValidKubernetesName ¶
func ValidLDAPName ¶
func ValidObjName ¶
func ValidRegion ¶
func ValidStoragePath ¶
func ValidateImagePath ¶
func ValidateImageVersion ¶
func ValidateNames ¶
walk through the map of names and values and validate the values return an error about which key had invalid value
Types ¶
type EmptyStringJsonNumber ¶
EmptyStringJsonNumber behaves like JsonNumber for valid numbers, but treats the empty string differently. JsonNumber marshals out the empty string as 0, but this marshals it out as the empty string. JsonNumber will fail to unmarshal the empty string, but this will allow it. This allows the field to distinguish between an unspecified value (the empty string) and a zero value.
func (EmptyStringJsonNumber) MarshalJSON ¶
func (s EmptyStringJsonNumber) MarshalJSON() ([]byte, error)
func (*EmptyStringJsonNumber) UnmarshalJSON ¶
func (s *EmptyStringJsonNumber) UnmarshalJSON(b []byte) error
type FormUrlEncodedClearer ¶
type FormUrlEncodedClearer struct {
// contains filtered or unexported fields
}
func NewFormUrlEncodedClearer ¶
func NewFormUrlEncodedClearer(fields ...string) *FormUrlEncodedClearer
func (*FormUrlEncodedClearer) Clear ¶
func (s *FormUrlEncodedClearer) Clear(data []byte) []byte
type JSONRedactor ¶
type JSONRedactor struct {
// contains filtered or unexported fields
}
func NewJSONRedactor ¶
func NewJSONRedactor(redactedVal string) *JSONRedactor
func (*JSONRedactor) AddKey ¶
func (s *JSONRedactor) AddKey(key string) *JSONRedactor