Documentation
¶
Overview ¶
Package hush is the public, ergonomic entry point for hush.
Most library users should need only this package.
V2 detector (recommended; catches secrets and PII):
import "github.com/valllabh/hush"
s, err := hush.New(hush.Options{UseDetector: true, DetectorPrefilter: true})
if err != nil { panic(err) }
defer s.Close()
findings, _ := s.ScanReader(reader)
masked, _, _ := s.Redact(text, "[REDACTED:%s]")
V1 sequence classifier (legacy, secrets only, faster on huge dirty input):
s, err := hush.New(hush.Options{MinConfidence: 0.9})
The default build uses the pure Go runtime from pkg/native — no CGO, no libonnxruntime, truly static. Advanced users who want to drive the extractor or classifier directly can reach pkg/{scanner,native,extractor}.
Index ¶
Constants ¶
const ModelVersion = native.ModelVersion
ModelVersion is the version of the classifier model compiled into this build. Surface this in --version output, request logs, or telemetry so you can correlate findings with a specific model.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Finding ¶
Scanner, Options and Finding are aliased from pkg/scanner so the hush namespace is complete on its own. Any value produced by hush can be passed to pkg/scanner functions and vice versa.
type Options ¶
Scanner, Options and Finding are aliased from pkg/scanner so the hush namespace is complete on its own. Any value produced by hush can be passed to pkg/scanner functions and vice versa.
type Scanner ¶
Scanner, Options and Finding are aliased from pkg/scanner so the hush namespace is complete on its own. Any value produced by hush can be passed to pkg/scanner functions and vice versa.
func Default ¶
Default returns a Scanner with the v2 detector + prefilter enabled. Mirrors `hush detect` defaults. Useful for one-shot scripts and examples that want sensible behaviour out of the box.
func New ¶
New returns a Scanner ready to use.
- Options.UseDetector=true: embedded v2 NER detector (secrets + PII). ModelOff is forced true; v1 classifier is not loaded.
- Options.UseDetector=false: embedded v1 sequence classifier (secrets). This is the legacy path; ModelOff=true skips the model and runs the extractor only.
DetectorPrefilter only affects the v2 path. It enables a regex+entropy gate in front of the model so files with no candidates skip the model entirely. Strongly recommended (1000x faster on clean files; quality is preserved or improved by a hybrid regex+model fusion).
Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
hush
command
hush: portable secrets and PII scrubber.
|
hush: portable secrets and PII scrubber. |
|
hush/cli
Package cli defines hush's cobra commands.
|
Package cli defines hush's cobra commands. |
|
internal
|
|
|
walker
Package walker collects scannable files from a set of paths.
|
Package walker collects scannable files from a set of paths. |
|
pkg
|
|
|
bundled
Package bundled wires the embedded classifier into pkg/scanner.
|
Package bundled wires the embedded classifier into pkg/scanner. |
|
extractor
Package extractor holds the regex+entropy candidate finder.
|
Package extractor holds the regex+entropy candidate finder. |
|
native
Package native is a pure Go transformer inference runtime for hush.
|
Package native is a pure Go transformer inference runtime for hush. |