domain

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CleanStrategy

type CleanStrategy string

CleanStrategy says what a cleaner may do.

const (
	CleanStrip      CleanStrategy = "strip"
	CleanNormalize  CleanStrategy = "normalize"
	CleanRewrite    CleanStrategy = "rewrite"
	CleanReportOnly CleanStrategy = "report_only"
)

func (CleanStrategy) Writable

func (s CleanStrategy) Writable() bool

Writable reports whether the strategy may mutate bytes.

type Confidence

type Confidence string

Confidence is how sure a detector is.

const (
	ConfidenceCertain   Confidence = "certain"
	ConfidenceLikely    Confidence = "likely"
	ConfidenceHeuristic Confidence = "heuristic"
)
const ConfidenceNone Confidence = "none"

ConfidenceNone disables fail-on.

func (Confidence) AtLeast

func (c Confidence) AtLeast(min Confidence) bool

AtLeast reports whether c meets the fail-on threshold.

func (Confidence) Rank

func (c Confidence) Rank() int

Rank returns a higher number for stronger confidence.

type Family

type Family string

Family groups detection algorithms.

const (
	FamilyUnicode   Family = "unicode"
	FamilyC2PA      Family = "c2pa"
	FamilyStamp     Family = "stamp"
	FamilyHomoglyph Family = "homoglyph"
	FamilyAST       Family = "ast"
	FamilyMetadata  Family = "metadata"
	FamilyHeuristic Family = "heuristic"
)

type Finding

type Finding struct {
	RuleID      string        `json:"rule_id" yaml:"rule_id"`
	Family      Family        `json:"family" yaml:"family"`
	Severity    Severity      `json:"severity" yaml:"severity"`
	Confidence  Confidence    `json:"confidence" yaml:"confidence"`
	Span        Span          `json:"span" yaml:"span"`
	Message     string        `json:"message" yaml:"message"`
	Evidence    string        `json:"evidence,omitempty" yaml:"evidence,omitempty"`
	Snippet     string        `json:"snippet,omitempty" yaml:"snippet,omitempty"`
	Symbol      string        `json:"symbol,omitempty" yaml:"symbol,omitempty"`
	Function    string        `json:"function,omitempty" yaml:"function,omitempty"`
	Kind        string        `json:"kind,omitempty" yaml:"kind,omitempty"`
	Clean       CleanStrategy `json:"clean" yaml:"clean"`
	Replacement string        `json:"replacement,omitempty" yaml:"replacement,omitempty"`
	Protect     bool          `json:"protect,omitempty" yaml:"protect,omitempty"`
	ProtectKind string        `json:"protect_kind,omitempty" yaml:"protect_kind,omitempty"`
}

Finding is one detector hit.

func (Finding) Key

func (f Finding) Key() string

Key is used for dedup.

type Kind

type Kind string

Kind is the blot pipeline class for a file (watermarks-remover layers).

const (
	KindText      Kind = "text"
	KindImage     Kind = "image"
	KindContainer Kind = "container"
)

type Language

type Language string

Language is a classified source kind.

const (
	LangUnknown   Language = ""
	LangGo        Language = "go"
	LangYAML      Language = "yaml"
	LangJSON      Language = "json"
	LangMarkdown  Language = "markdown"
	LangHTML      Language = "html"
	LangText      Language = "text"
	LangImage     Language = "image"
	LangContainer Language = "container"
)

type Patch

type Patch struct {
	Path     string    `json:"path" yaml:"path"`
	Original []byte    `json:"-" yaml:"-"`
	Updated  []byte    `json:"-" yaml:"-"`
	Applied  []Finding `json:"applied,omitempty" yaml:"applied,omitempty"`
	Skipped  []Finding `json:"skipped,omitempty" yaml:"skipped,omitempty"`
}

Patch is a planned mutation of a single file.

func (Patch) Changed

func (p Patch) Changed() bool

Changed reports whether Updated differs from Original.

type Score

type Score struct {
	Percent    int            `json:"percent" yaml:"percent"`
	Agent      string         `json:"agent" yaml:"agent"`
	Label      string         `json:"label" yaml:"label"`
	Agents     map[string]int `json:"agents,omitempty" yaml:"agents,omitempty"`
	Confidence Confidence     `json:"confidence,omitempty" yaml:"confidence,omitempty"`
	Evidence   []string       `json:"evidence,omitempty" yaml:"evidence,omitempty"`
}

Score is an aggregate forensic AI-trace estimate for a scan.

type Severity

type Severity string

Severity is a finding impact class.

const (
	SeverityInfo    Severity = "info"
	SeverityWarning Severity = "warning"
	SeverityError   Severity = "error"
)

type Span

type Span struct {
	File  string `json:"file" yaml:"file"`
	Start int    `json:"start" yaml:"start"`
	End   int    `json:"end" yaml:"end"`
	Line  int    `json:"line" yaml:"line"`
	Col   int    `json:"col" yaml:"col"`
}

Span is a UTF-8 byte range inside a file.

func (Span) Contains

func (s Span) Contains(o Span) bool

Contains reports whether o is fully inside s.

func (Span) Overlaps

func (s Span) Overlaps(o Span) bool

Overlaps reports whether two spans share bytes in the same file.

func (Span) Valid

func (s Span) Valid() bool

Valid reports whether the span has a non-empty range.

type Unit

type Unit struct {
	Path     string   `json:"path"`
	RelPath  string   `json:"rel_path,omitempty"`
	Bytes    []byte   `json:"-"`
	Charset  string   `json:"charset,omitempty"`
	Language Language `json:"language,omitempty"`
	Kind     Kind     `json:"kind,omitempty"`
	HasBOM   bool     `json:"has_bom,omitempty"`
}

Unit is a decoded file ready for detectors. Detectors must not read the FS.

Jump to

Keyboard shortcuts

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