utils

package
v1.0.9 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2025 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var TimeoutError = fmt.Errorf("Timeout occurred")
View Source
var UserNoProxyRE = regexp.MustCompile(`^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])(\/(3[0-2]|[1-2][0-9]|[0-9]))$|^(.?[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z0-9][a-z0-9-]{0,61}[a-z0-9]$|^""$`)

the following regex defines four different patterns: first pattern is to validate IPv4 address second,is for IPv4 CIDR range validation third pattern is to validate domains and the fourth petterrn is to be able to remove the existing no-proxy value by typing empty string (""). nolint

Functions

func Contains added in v0.1.73

func Contains[T comparable](slice []T, element T) bool

func HasDuplicates added in v0.1.65

func HasDuplicates(valSlice []string) (string, bool)

func IsURL

func IsURL(val interface{}) error

IsURL validates whether the given value is a valid URL

func JwksEqual added in v1.0.4

func JwksEqual(
	jwksStrA string,
	jwksStrB string,
) bool

Checks if two string parameters represent equal json web key sets. false is returned if the two jwks do not have equivalent values, or if there is an error processing the expected fields of either parameter.

func MapKeys added in v0.1.74

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

func MatchNoPorxyRE added in v0.1.65

func MatchNoPorxyRE(noProxyValues []string) error

func RetryWithBackoffandTimeout added in v1.0.5

func RetryWithBackoffandTimeout(
	f func() (bool, error),
	timeoutSeconds int,
	log *log.Logger,
) error

Tries the passed in function multiple times within a timeout window, sleeping with backoff in between calls. When non-nil logger is passed as a parameter, log messages about the retry logic will be sent.

func SliceToSortedString added in v0.1.73

func SliceToSortedString(s []string) string

func SortStringRespectLength added in v0.1.73

func SortStringRespectLength(s []string)

func ValidateAdditionalTrustBundle

func ValidateAdditionalTrustBundle(val interface{}) error

func ValidateHTTPProxy

func ValidateHTTPProxy(val interface{}) error

Types

This section is empty.

Jump to

Keyboard shortcuts

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