generic

package
v0.60.2 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2022 License: Apache-2.0 Imports: 12 Imported by: 76

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cataloger

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

Cataloger implements the Catalog interface and is responsible for dispatching the proper parser function for a given path or glob pattern. This is intended to be reusable across many package cataloger types.

func NewCataloger

func NewCataloger(upstreamCataloger string) *Cataloger

NewCataloger if provided path-to-parser-function and glob-to-parser-function lookups creates a Cataloger

func (*Cataloger) Catalog

func (c *Cataloger) Catalog(resolver source.FileResolver) ([]pkg.Package, []artifact.Relationship, error)

Catalog is given an object to resolve file references and content, this function returns any discovered Packages after analyzing the catalog source.

func (*Cataloger) Name

func (c *Cataloger) Name() string

Name returns a string that uniquely describes the upstream cataloger that this Generic Cataloger represents.

func (*Cataloger) WithParserByGlobs

func (c *Cataloger) WithParserByGlobs(parser Parser, globs ...string) *Cataloger

func (*Cataloger) WithParserByMimeTypes

func (c *Cataloger) WithParserByMimeTypes(parser Parser, types ...string) *Cataloger

func (*Cataloger) WithParserByPath

func (c *Cataloger) WithParserByPath(parser Parser, paths ...string) *Cataloger

type Classifier

type Classifier struct {
	Package string
	// FilepathPatterns is a list of regular expressions that will be used to match against the file path of a given
	// source location. If any of the patterns match, the file will be considered a candidate for parsing.
	// If no patterns are provided, the reader is automatically considered a candidate.
	FilepathPatterns []*regexp.Regexp
	// EvidencePattern is a list of regular expressions that will be used to match against the file contents of a
	// given file in the source location. If any of the patterns match, the file will be considered a candidate for parsing.
	EvidencePatterns []*regexp.Regexp
	// CPE is the CPE we want to match against
	CPEs []pkg.CPE
}

Classifier is a generic package classifier that can be used to match a package definition to a file that meets the given content criteria of the EvidencePatternTemplates.

func (Classifier) Examine

func (c Classifier) Examine(reader source.LocationReadCloser) (p *pkg.Package, r *artifact.Relationship, err error)

type Environment

type Environment struct {
	LinuxRelease *linux.Release
}

Jump to

Keyboard shortcuts

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