siegfried: github.com/richardlehane/siegfried/pkg/config Index | Files

package config

import "github.com/richardlehane/siegfried/pkg/config"

Package config sets up defaults used by both the SF and roy tools Config options can be overridden with build flags e.g. the brew and archivematica files.

Core siegfried defaults

Index

Package Files

config.go decompress.go default.go identifier.go loc.go mimeinfo.go multi.go pronom.go siegfried.go

func ChangesURL Uses

func ChangesURL() string

func Checkpoint Uses

func Checkpoint(i int64) bool

Checkpoint reports the offset at which slow logging should trigger.

func Choices Uses

func Choices() int

Choices is a bytematcher setting. It controls the number of tolerable strings produced by processing signature segments. E.g. signature has two adjoining frames ("PDF") and ("1.1" OR "1.2") it can be processed into two search strings: "PDF1.1" and "PDF1.2". A low number of choices means a smaller Aho Corasick search tree and more patterns to follow-up. A large of choices means a larger Aho Corasick search tree and more signatures immediately satisfied without follow-up pattern matching.

func Clear Uses

func Clear() func() private

Clear clears loc and mimeinfo details to avoid pollution when creating multiple identifiers in same session

func Conf Uses

func Conf() string

Conf returns the path to the siegfried configuration file.

func Container Uses

func Container() string

Container returns the location of the DROID container signature file. If not set, infers the latest file.

func ContainerBase Uses

func ContainerBase() string

ContainerBase returns the base filename of the DROID container signature file. If not set, infers the latest file.

func Debug Uses

func Debug() bool

Debug reports whether debug logging is activated.

func Details Uses

func Details(extra ...string) string

Details returns a description of the identifier. This is auto-populated if not set directly. Extra information from signatures such as date last modified can be given to this function.

func Distance Uses

func Distance() int

Distance is a bytematcher setting. It controls the absolute widths at which segments in signatures are split. E.g. if segments are separated by a minimum of 50 and maximum of 100 bytes, the distance is 100. A short distance means a smaller Aho Corasick search tree and more patterns to follow-up. A long distance means a larger Aho Corasick search tree and more signatures immediately satisfied without follow-up pattern matching.

func DoubleUp Uses

func DoubleUp() bool

DoubleUp reports whether the doubleup flag has been set. This will cause byte signatures to be built for formats where container signatures are also provided.

func Droid Uses

func Droid() string

DROID returns the location of the DROID signature file. If not set, infers the latest file.

func DroidBase Uses

func DroidBase() string

DROID base returns the base filename of the DROID signature file. If not set, infers the latest file.

func Exclude Uses

func Exclude(ids []string) []string

Exclude takes a slice of puids and omits those that are also in the identifier.exclude slice.

func ExcludeDoubles Uses

func ExcludeDoubles(puids, cont []string) []string

ExcludeDoubles takes a slice of puids and a slice of container puids and excludes those that are in the container slice, if nodoubles is set.

func Extend Uses

func Extend() []string

Extend reports whether a set of signature extensions has been provided.

func ExtendC Uses

func ExtendC() []string

Extend reports whether a set of container signature extensions has been provided.

func Fpr Uses

func Fpr() string

Fpr reports whether sf is being run in -fpr (Archivematica format policy registry) mode.

func HarvestOptions Uses

func HarvestOptions() (string, time.Duration, time.Duration, *http.Transport)

HarvestOptions reports the PRONOM url, timeout and transport.

func HasExclude Uses

func HasExclude() bool

HasExclude reports whether an exlusion set of signatures has been provided.

func HasLimit Uses

func HasLimit() bool

HasLimit reports whether a limited set of signatures has been selected.

func Home Uses

func Home() string

Home reports the siegfried HOME location (e.g. /usr/home/siegfried).

func LOC Uses

func LOC() string

LOC returns the location of the LOC signature file.

func Limit Uses

func Limit(ids []string) []string

Limit takes a slice of puids and returns a new slice containing only those puids in the limit set.

func Local Uses

func Local(base string) string

Home makes a path local to Home() if it is relative

func MIMEInfo Uses

func MIMEInfo() string

MIMEInfo returns the location of the MIMEInfo signature file.

func MIMEVersion Uses

func MIMEVersion() []string

func Magic Uses

func Magic() []byte

Magic returns the magic string encoded at the start of a siegfried signature file.

func MaxBOF Uses

func MaxBOF() int

MaxBOF returns any BOF buffer limit set.

func MaxEOF Uses

func MaxEOF() int

MaxEOF returns any EOF buffer limit set.

func Name Uses

func Name() string

Name returns the name of the identifier.

func NoByte Uses

func NoByte() bool

NoByte reports whether byte signatures should be omitted.

func NoContainer Uses

func NoContainer() bool

NoContainer reports whether container signatures should be omitted.

func NoEOF Uses

func NoEOF() bool

NoEOF reports whether end of file segments of signatures should be trimmed.

func NoMIME Uses

func NoMIME() bool

NoMIME reports whether MIME signatures should be omitted.

func NoName Uses

func NoName() bool

NoName reports whether filename signatures should be omitted.

func NoPRONOM Uses

func NoPRONOM() bool

func NoPriority Uses

func NoPriority() bool

NoPriority reports whether priorities between signatures should be omitted.

func NoRIFF Uses

func NoRIFF() bool

NoRIFF reports whether RIFF FOURCC signatures should be omitted.

func NoText Uses

func NoText() bool

NoText reports whether text signatures should be omitted.

func NoXML Uses

func NoXML() bool

NoXML reports whether XML signatures should be omitted.

func Out Uses

func Out() io.Writer

Out reports the target for logging messages (STDOUT or STDIN).

func Range Uses

func Range() int

Range is a bytematcher setting. It controls the relative widths at which segments in signatures are split. E.g. if segments are separated by a minimum of 50 and maximum of 100 bytes, the range is 50. A small range means a smaller Aho Corasick search tree and more patterns to follow-up. A large range means a larger Aho Corasick search tree and more signatures immediately satisfied without follow-up pattern matching.

func Reports Uses

func Reports() string

Reports returns the location of the PRONOM reports directory.

func SetBOF Uses

func SetBOF(b int) func() private

SetBOF limits the number of bytes to scan from the beginning of file.

func SetChoices Uses

func SetChoices(i int) func() private

SetDistance sets the choices variable for the bytematcher.

func SetConf Uses

func SetConf(s string)

SetConf sets the configuration filename or filepath.

func SetContainer Uses

func SetContainer(c string) func() private

SetContainer sets the name and/or location of the DROID container signature file. I.e. can provide a full path or a filename relative to the HOME directory.

func SetDebug Uses

func SetDebug()

SetDebug sets degub logging on.

func SetDetails Uses

func SetDetails(d string) func() private

SetDetails sets the identifier's description. If not provided, this description is automatically generated based on options set.

func SetDistance Uses

func SetDistance(i int) func() private

SetDistance sets the distance variable for the bytematcher.

func SetDoubleUp Uses

func SetDoubleUp() func() private

SetDoubleUp causes byte signatures to be built for formats where container signatures are also provided.

func SetDroid Uses

func SetDroid(d string) func() private

SetDroid sets the name and/or location of the DROID signature file. I.e. can provide a full path or a filename relative to the HOME directory.

func SetEOF Uses

func SetEOF(e int) func() private

SetEOF limits the number of bytes to scan from the end of file.

func SetExclude Uses

func SetExclude(l []string) func() private

SetExclude excludes the provided signatures from those built.

func SetExtend Uses

func SetExtend(l []string) func() private

SetExtend adds extension signatures to the build.

func SetExtendC Uses

func SetExtendC(l []string) func() private

SetExtendC adds container extension signatures to the build.

func SetHarvestThrottle Uses

func SetHarvestThrottle(d time.Duration)

func SetHarvestTimeout Uses

func SetHarvestTimeout(d time.Duration)

SetHarvestTimeout sets a time limit on PRONOM harvesting.

func SetHarvestTransport Uses

func SetHarvestTransport(t *http.Transport)

SetHarvestTransport sets the PRONOM harvesting transport.

func SetHome Uses

func SetHome(h string)

SetHome sets the siegfried HOME location (e.g. /usr/home/siegfried).

func SetLOC Uses

func SetLOC(fdd string) func() private

func SetLimit Uses

func SetLimit(l []string) func() private

SetLimit limits the set of signatures built to the list provide.

func SetMIMEInfo Uses

func SetMIMEInfo(mi string) func() private

func SetMulti Uses

func SetMulti(m string) func() private

SetMulti defines how identifiers report multiple results.

func SetName Uses

func SetName(n string) func() private

SetName sets the name of the identifier.

func SetNoByte Uses

func SetNoByte() func() private

SetNoByte will cause byte signatures to be omitted.

func SetNoContainer Uses

func SetNoContainer() func() private

SetNoContainer will cause container signatures to be omitted.

func SetNoEOF Uses

func SetNoEOF() func() private

SetNoEOF will cause end of file segments to be trimmed from signatures.

func SetNoMIME Uses

func SetNoMIME() func() private

SetNoMIME will cause MIME signatures to be omitted.

func SetNoName Uses

func SetNoName() func() private

SetNoName will cause extension signatures to be omitted.

func SetNoPRONOM Uses

func SetNoPRONOM() func() private

func SetNoRIFF Uses

func SetNoRIFF() func() private

SetNoRIFF will cause RIFF FOURCC signatures to be omitted.

func SetNoReports Uses

func SetNoReports() func() private

SetNoReports instructs roy to build from the DROID signature file alone (and not from the PRONOM reports).

func SetNoText Uses

func SetNoText() func() private

SetNoText will cause text signatures to be omitted.

func SetNoXML Uses

func SetNoXML() func() private

SetNoXML will cause XML signatures to be omitted.

func SetOut Uses

func SetOut(o io.Writer)

SetOut sets the target for logging.

func SetRange Uses

func SetRange(i int) func() private

SetRange sets the range variable for the bytematcher.

func SetSignature Uses

func SetSignature(s string)

SetSignature sets the signature filename or filepath.

func SetSlow Uses

func SetSlow()

SetSlow sets slow logging on.

func Signature Uses

func Signature() string

Signature returns the path to the siegfried signature file.

func SignatureBase Uses

func SignatureBase() string

SignatureBase returns the filename of the siegfried signature file.

func Slow Uses

func Slow() bool

Slow reports whether slow logging is activated.

func TextMIME Uses

func TextMIME() string

func TextPuid Uses

func TextPuid() string

TextPuid reports the puid for a text file.

func UpdateOptions Uses

func UpdateOptions() (string, time.Duration, *http.Transport)

UpdateOptions returns the update URL, timeout and transport for the sf -update command.

func Version Uses

func Version() [3]int

Version reports the siegfried version.

func ZipLOC Uses

func ZipLOC() string

func ZipMIME Uses

func ZipMIME() string

func ZipPuid Uses

func ZipPuid() string

ZipPuid reports the puid for a zip archive.

type Archive Uses

type Archive int

Archive is a file format capable of decompression by sf.

const (
    None Archive = iota // None means the format cannot be decompressed by sf.
    Zip
    Gzip
    Tar
    ARC
    WARC
)

func IsArchive Uses

func IsArchive(id string) Archive

IsArchive returns an Archive that corresponds to the provided id (or none if no match).

func (Archive) String Uses

func (a Archive) String() string

type Multi Uses

type Multi int

Multi defines how identifiers treat multiple results.

const (
    Single        Multi = iota // Return a single result. If there is more than one result with the highest score, return UNKNOWN and a warning
    Conclusive                 // Default. Return only the results with the highest score.
    Positive                   // Return any result with a strong score (or if only weak results, return all). This means a byte match, container match or XML match. Text/MIME/extension-only matches are considered weak.
    Comprehensive              // Same as positive but also turn off the priority rules during byte matching.
    Exhaustive                 // Turn off priority rules during byte matching and return all weak as well as strong results.
)

func GetMulti Uses

func GetMulti() Multi

GetMulti returns the multi setting

func (Multi) String Uses

func (m Multi) String() string

type Option Uses

type Option func() private

Option is a private but exported type. It is a function that sets a siegfried option.

Package config imports 11 packages (graph) and is imported by 15 packages. Updated 2019-02-23. Refresh now. Tools for package owners.