Documentation
¶
Index ¶
- type Cataloger
- func (c *Cataloger) Catalog(resolver source.FileResolver) ([]pkg.Package, []artifact.Relationship, error)
- func (c *Cataloger) Name() string
- func (c *Cataloger) WithParserByGlobs(parser Parser, globs ...string) *Cataloger
- func (c *Cataloger) WithParserByMimeTypes(parser Parser, types ...string) *Cataloger
- func (c *Cataloger) WithParserByPath(parser Parser, paths ...string) *Cataloger
- type Classifier
- type Environment
- type Parser
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 ¶
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 ¶
Name returns a string that uniquely describes the upstream cataloger that this Generic Cataloger represents.
func (*Cataloger) WithParserByGlobs ¶
func (*Cataloger) WithParserByMimeTypes ¶
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
// EvidencePatterns 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
// CPEs are the specific CPEs we want to include for this binary with updated version information
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 Parser ¶
type Parser func(source.FileResolver, *Environment, source.LocationReadCloser) ([]pkg.Package, []artifact.Relationship, error)