utils

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

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 DelayedRetry added in v0.1.76

func DelayedRetry(f func() error, maxRetries int, delay time.Duration) error

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 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 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