clair: Index | Files | Directories

package featurens

import ""

Package featurens exposes functions to dynamically register methods for determining a namespace for features present in an image layer.


Package Files


func Detect Uses

func Detect(files tarutil.FilesMap, toUse []database.Detector) ([]database.LayerNamespace, error)

Detect uses detectors specified to retrieve the detect result.

func ListDetectors Uses

func ListDetectors() []database.Detector

ListDetectors returns the info of all registered namespace detectors.

func RegisterDetector Uses

func RegisterDetector(name string, version string, d Detector)

RegisterDetector makes a detector available by the provided name.

If called twice with the same name, the name is blank, or if the provided Detector is nil, this function panics.

func RequiredFilenames Uses

func RequiredFilenames(toUse []database.Detector) (files []string)

RequiredFilenames returns all file patterns that will be passed to the given extensions. These patterns are expressed as regexps. Any extension metadata that has non namespace-detector type will be skipped.

func TestDetector Uses

func TestDetector(t *testing.T, d Detector, testData []TestData)

TestDetector runs a Detector on each provided instance of TestData and asserts the output to be equal to the expected output.

type Detector Uses

type Detector interface {
    // Detect attempts to determine a Namespace from a FilesMap of an image
    // layer.
    Detect(tarutil.FilesMap) (*database.Namespace, error)

    // RequiredFilenames returns a list of patterns for filenames that will
    // be in the FilesMap provided to the Detect method.
    // The patterns are expressed as regexps, and will be matched against
    // full paths that do not include the leading "/".
    RequiredFilenames() []string

Detector represents an ability to detect a namespace used for organizing features present in an image layer.

type TestData Uses

type TestData struct {
    Files             tarutil.FilesMap
    ExpectedNamespace *database.Namespace

TestData represents the data used to test an implementation of Detector.


alpinereleasePackage alpinerelease implements a featurens.Detector for Alpine Linux based container image layers.
aptsourcesPackage aptsources implements a featurens.Detector for apt based container image layers.
lsbreleasePackage lsbrelease implements a featurens.Detector for container image layers containing an lsb-release file.
osreleasePackage osrelease implements a featurens.Detector for container image layers containing an os-release file.
redhatreleasePackage redhatrelease implements a featurens.Detector for container image layers containing an redhat-release-like files.

Package featurens imports 6 packages (graph) and is imported by 46 packages. Updated 2019-12-31. Refresh now. Tools for package owners.