- pkg/engine/sources/source.go: Source interface using pkg/types.Chunk
- pkg/engine/sources/file.go: FileSource with overlapping chunk reads
- pkg/engine/filter.go: KeywordFilter using Aho-Corasick pre-filter
- pkg/engine/detector.go: Detect with regex matching + Shannon entropy check
- pkg/engine/engine.go: Engine.Scan orchestrating 3-stage pipeline with ants pool
- pkg/engine/scanner_test.go: filled test stubs with pipeline integration tests
- testdata/samples: fixed anthropic key lengths to match {93,} regex pattern
16 lines
496 B
Go
16 lines
496 B
Go
package sources
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/salvacybersec/keyhunter/pkg/types"
|
|
)
|
|
|
|
// Source is the interface all input adapters must implement.
|
|
// Chunks writes content segments to the out channel until the source is exhausted or ctx is cancelled.
|
|
// NOTE: Source is defined in the sources sub-package (not pkg/engine) and uses pkg/types.Chunk
|
|
// to avoid a circular import: engine -> sources -> engine.
|
|
type Source interface {
|
|
Chunks(ctx context.Context, out chan<- types.Chunk) error
|
|
}
|