mirror of
https://github.com/anchore/grype
synced 2024-11-10 06:34:13 +00:00
70ec3bfb71
* Add injectable HTTP client to file getter Signed-off-by: Dan Luhring <dan.luhring@anchore.com> * WIP: Map config for custom CA certs Signed-off-by: Dan Luhring <dan.luhring@anchore.com> * update curator and add tests Signed-off-by: Alex Goodman <alex.goodman@anchore.com> * add TLS helper scripts Signed-off-by: Alex Goodman <alex.goodman@anchore.com> * remove grype-db local mod edit Signed-off-by: Alex Goodman <alex.goodman@anchore.com> * tidy go modules Signed-off-by: Alex Goodman <alex.goodman@anchore.com> * use ssl.context over deprecated fn Signed-off-by: Alex Goodman <alex.goodman@anchore.com> * disallow tls 1 and 1.1 Signed-off-by: Alex Goodman <alex.goodman@anchore.com> * suppress non-archive sources for fetch-to-dir capability Signed-off-by: Alex Goodman <alex.goodman@anchore.com> * ensure DB load failure does not panic Signed-off-by: Alex Goodman <alex.goodman@anchore.com> * address review comments Signed-off-by: Alex Goodman <alex.goodman@anchore.com> Co-authored-by: Alex Goodman <alex.goodman@anchore.com>
25 lines
577 B
Go
25 lines
577 B
Go
package internal
|
|
|
|
import "strings"
|
|
|
|
// HasAnyOfSuffixes returns an indication if the given string has any of the given suffixes.
|
|
func HasAnyOfSuffixes(input string, suffixes ...string) bool {
|
|
for _, suffix := range suffixes {
|
|
if strings.HasSuffix(input, suffix) {
|
|
return true
|
|
}
|
|
}
|
|
|
|
return false
|
|
}
|
|
|
|
// HasAnyOfPrefixes returns an indication if the given string has any of the given prefixes.
|
|
func HasAnyOfPrefixes(input string, prefixes ...string) bool {
|
|
for _, prefix := range prefixes {
|
|
if strings.HasPrefix(input, prefix) {
|
|
return true
|
|
}
|
|
}
|
|
|
|
return false
|
|
}
|