config

package
v1.6.4 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2016 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

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

Constants

This section is empty.

Variables

This section is empty.

Functions

func Checkpoint

func Checkpoint(i int64) bool

Checkpoint reports the offset at which slow logging should trigger.

func Choices

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 Container

func Container() string

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

func ContainerBase

func ContainerBase() string

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

func Debug

func Debug() bool

Debug reports whether debug logging is activated.

func Details

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

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

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

func Droid() string

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

func DroidBase

func DroidBase() string

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

func Exclude

func Exclude(ids []string) []string

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

func ExcludeDoubles

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

func Extend() []string

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

func ExtendC

func ExtendC() []string

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

func Fpr

func Fpr() string

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

func HarvestOptions

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

HarvestOptions reports the PRONOM url, timeout and transport.

func HasExclude

func HasExclude() bool

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

func HasLimit

func HasLimit() bool

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

func Home

func Home() string

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

func LOC

func LOC() string

LOC returns the location of the LOC signature file.

func Limit

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 MIMEInfo

func MIMEInfo() string

MIMEInfo returns the location of the MIMEInfo signature file.

func Magic

func Magic() []byte

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

func MaxBOF

func MaxBOF() int

MaxBOF returns any BOF buffer limit set.

func MaxEOF

func MaxEOF() int

MaxEOF returns any EOF buffer limit set.

func Name

func Name() string

Name returns the name of the identifier.

func NoContainer

func NoContainer() bool

NoContainer reports whether container signatures should be omitted.

func NoEOF

func NoEOF() bool

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

func NoMIME

func NoMIME() bool

NoMIME reports whether MIME signatures should be omitted.

func NoName

func NoName() bool

NoName reports whether filename signatures should be omitted.

func NoPRONOM

func NoPRONOM() bool

func NoPriority

func NoPriority() bool

NoPriority reports whether priorities between signatures should be omitted.

func NoRIFF

func NoRIFF() bool

NoRIFF reports whether RIFF FOURCC signatures should be omitted.

func NoText

func NoText() bool

NoText reports whether text signatures should be omitted.

func NoXML

func NoXML() bool

NoXML reports whether XML signatures should be omitted.

func Out

func Out() io.Writer

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

func Range

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

func Reports() string

Reports returns the location of the PRONOM reports directory.

func SetBOF

func SetBOF(b int) func() private

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

func SetChoices

func SetChoices(i int) func() private

SetDistance sets the choices variable for the bytematcher.

func SetContainer

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

func SetDebug()

SetDebug sets degub logging on.

func SetDetails

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

func SetDistance(i int) func() private

SetDistance sets the distance variable for the bytematcher.

func SetDoubleUp

func SetDoubleUp() func() private

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

func SetDroid

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

func SetEOF(e int) func() private

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

func SetExclude

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

SetExclude excludes the provided signatures from those built.

func SetExtend

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

SetExtend adds extension signatures to the build.

func SetExtendC

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

SetExtendC adds container extension signatures to the build.

func SetHarvestThrottle

func SetHarvestThrottle(d time.Duration)

func SetHarvestTimeout

func SetHarvestTimeout(d time.Duration)

SetHarvestTimeout sets a time limit on PRONOM harvesting.

func SetHarvestTransport

func SetHarvestTransport(t *http.Transport)

SetHarvestTransport sets the PRONOM harvesting transport.

func SetHome

func SetHome(h string)

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

func SetLOC

func SetLOC(fdd string) func() private

func SetLimit

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

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

func SetMIMEInfo

func SetMIMEInfo(mi string) func() private

func SetMulti

func SetMulti(m string) func() private

SetMulti defines how identifiers report multiple results.

func SetName

func SetName(n string) func() private

SetName sets the name of the identifier.

func SetNoContainer

func SetNoContainer() func() private

SetNoContainer will cause container signatures to be omitted.

func SetNoEOF

func SetNoEOF() func() private

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

func SetNoMIME

func SetNoMIME() func() private

SetNoMIME will cause MIME signatures to be omitted.

func SetNoName

func SetNoName() func() private

SetNoName will cause extension signatures to be omitted.

func SetNoPRONOM

func SetNoPRONOM() func() private

func SetNoRIFF

func SetNoRIFF() func() private

SetNoRIFF will cause RIFF FOURCC signatures to be omitted.

func SetNoReports

func SetNoReports() func() private

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

func SetNoText

func SetNoText() func() private

SetNoText will cause text signatures to be omitted.

func SetNoXML

func SetNoXML() func() private

SetNoXML will cause XML signatures to be omitted.

func SetOut

func SetOut(o io.Writer)

SetOut sets the target for logging.

func SetRange

func SetRange(i int) func() private

SetRange sets the range variable for the bytematcher.

func SetSignature

func SetSignature(s string)

SetSignature sets the signature filename or filepath.

func SetSlow

func SetSlow()

SetSlow sets slow logging on.

func Signature

func Signature() string

Signature returns the path to the siegfried signature file.

func SignatureBase

func SignatureBase() string

SignatureBase returns the filename of the siegfried signature file.

func Slow

func Slow() bool

Slow reports whether slow logging is activated.

func TextMIME

func TextMIME() string

func TextPuid

func TextPuid() string

TextPuid reports the puid for a text file.

func UpdateOptions

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

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

func Version

func Version() [3]int

Version reports the siegfried version.

func ZipLOC

func ZipLOC() string

func ZipMIME

func ZipMIME() string

func ZipPuid

func ZipPuid() string

ZipPuid reports the puid for a zip archive.

Types

type Archive

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

func IsArchive(id string) Archive

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

func (Archive) String

func (a Archive) String() string

type Multi

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

func GetMulti() Multi

func (Multi) String

func (m Multi) String() string

type Option

type Option func() private

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

Jump to

Keyboard shortcuts

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