common

package
v3.2.2 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2022 License: AGPL-3.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	KB, MB, GB, TB, PB = 1e3, 1e6, 1e9, 1e12, 1e15
	IGNORED_EXTENSIONS = []string{"pdf", "mp4", "avi", "mpeg", "mpg", "mov", "wmv", "m4p", "swf", "mp2", "flv", "vob", "webm", "hdv", "3gp", "ogg", "mp3", "wav", "flac", "tif", "tiff", "jpg", "jpeg", "png", "gif", "zip", "webp"}
)
View Source
var MatchError = errors.New("chunk doesn't match")

Functions

func AddStringSliceItem

func AddStringSliceItem(item string, slice *[]string)

func HandleTestChannel

func HandleTestChannel(chunksCh chan *sources.Chunk, cf ChunkFunc) error

func IsDone

func IsDone(ctx context.Context) bool

func PinnedCertPool

func PinnedCertPool() *x509.CertPool

func PinnedRetryableHttpClient

func PinnedRetryableHttpClient() *http.Client

func RemoveStringSliceItem

func RemoveStringSliceItem(item string, slice *[]string)

func RetryableHttpClient

func RetryableHttpClient() *http.Client

func SaneHttpClient

func SaneHttpClient() *http.Client

func SaneHttpClientTimeOut

func SaneHttpClientTimeOut(timeOutSeconds int64) *http.Client

custom timeout for some scanners

func SkipFile

func SkipFile(filename string, data []byte) bool

Types

type ChunkFunc

type ChunkFunc func(chunk *sources.Chunk) error

type CustomTransport

type CustomTransport struct {
	T http.RoundTripper
}

func NewCustomTransport

func NewCustomTransport(T http.RoundTripper) *CustomTransport

func (*CustomTransport) RoundTrip

func (t *CustomTransport) RoundTrip(req *http.Request) (*http.Response, error)

type Filter

type Filter struct {
	// contains filtered or unexported fields
}

func FilterEmpty

func FilterEmpty() *Filter

FilterEmpty returns a Filter that always passes.

func FilterFromFiles

func FilterFromFiles(includeFilterPath, excludeFilterPath string) (*Filter, error)

FilterFromFiles creates a Filter using the rules in the provided include and exclude files.

func (*Filter) Pass

func (filter *Filter) Pass(object string) bool

Pass returns true if the include FilterRuleSet matches the pattern and the exclude FilterRuleSet does not match.

type FilterRuleSet

type FilterRuleSet []regexp.Regexp

func FilterRulesFromFile

func FilterRulesFromFile(source string) (*FilterRuleSet, error)

FilterRulesFromFile loads the list of regular expression filter rules in `source` and creates a FilterRuleSet.

func (*FilterRuleSet) Matches

func (rules *FilterRuleSet) Matches(object string) bool

Matches will return true if any of the regular expressions in the FilterRuleSet match the pattern.

type Secret

type Secret struct {
	// contains filtered or unexported fields
}

func GetSecret

func GetSecret(ctx context.Context, gcpProject, name string) (secret *Secret, err error)

func GetSecretFromEnv added in v3.0.2

func GetSecretFromEnv(filename string) (secret *Secret, err error)

func GetTestSecret

func GetTestSecret(ctx context.Context) (secret *Secret, err error)

func (*Secret) MustGetField

func (s *Secret) MustGetField(name string) string

Jump to

Keyboard shortcuts

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