You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
pkg/subenum: export Permutations and Diff helpers #197
Permutation generation and diffing are CLI-only; the library exposes just Run and Scan. Both are pure functions with no DNS and would be cheap to export.
Where
internal/permute/permute.go:28 (Generate is internal)
main_diff.go (diff logic lives in the main package)
Export subenum.Permutations(seeds, words []string) []string and subenum.Diff(prev, cur []Result) Changes (added, removed, and later changed). Document both in docs/library.md.
Who benefits
Embedders building their own pipelines or monitors.
Open questions
API surface before 1.0 (ROADMAP says it may change); keep signatures minimal
Partly done in ee04020: subenum.Permutations(seeds, words []string) []string now wraps internal/permute.Generate (the same generator -permute uses; nil words selects the built-in list), with tests, ExamplePermutations, a section in docs/library.md and a CHANGELOG entry. Verified with go test -race ./pkg/....
Still open: Diff. Its logic lives in package main (main_diff.go), so exporting it without duplication means moving it to an internal package first, and three choices need settling: whether removed is a plain set difference (the CLI only reports a name removed after a fresh NXDOMAIN on a complete run, and skips excluded names), whether changed compares every record type or takes a types argument (the CLI compares only the looked-up types, CNAME targets first), and the shape of the returned Changes.
Diff done in 0998773, which closes this out along with the earlier Permutations work.
The open questions are settled as follows:
API:subenum.Diff(previous, current []Result, types []string) Changes, where Changes holds Added, Removed and Changed, and each Change has Name, Previous and Current.
Removed: a plain set difference. Diff stays pure (no DNS), and the godoc says to re-check removed names, since the CLI reports a name removed only after a fresh NXDOMAIN on a complete run.
Changed: the same rule as -diff-records: sets over types (every type when nil), and only CNAME targets when an alias is involved. A previous result without records is never reported as changed.
No duplicate logic: the comparison moved from package main into internal/diff, which both the CLI and the library call.
Verified with TestDiff*, ExampleDiff, internal/diff tests, the full go test ./... and golangci-lint.
Activity
feat(pkg): export Permutations from pkg/subenum (#197)
TMHSDigital commentedon Nov 10, 2026
Partly done in ee04020:
subenum.Permutations(seeds, words []string) []stringnow wrapsinternal/permute.Generate(the same generator-permuteuses;nilwords selects the built-in list), with tests,ExamplePermutations, a section indocs/library.mdand a CHANGELOG entry. Verified withgo test -race ./pkg/....Still open: Diff. Its logic lives in package
main(main_diff.go), so exporting it without duplication means moving it to an internal package first, and three choices need settling: whether removed is a plain set difference (the CLI only reports a name removed after a fresh NXDOMAIN on a complete run, and skips excluded names), whether changed compares every record type or takes atypesargument (the CLI compares only the looked-up types, CNAME targets first), and the shape of the returnedChanges.TMHSDigital commentedon Nov 13, 2026
Diff done in 0998773, which closes this out along with the earlier Permutations work.
The open questions are settled as follows:
subenum.Diff(previous, current []Result, types []string) Changes, whereChangesholdsAdded,RemovedandChanged, and eachChangehasName,PreviousandCurrent.-diff-records: sets overtypes(every type when nil), and only CNAME targets when an alias is involved. A previous result without records is never reported as changed.internal/diff, which both the CLI and the library call.Verified with
TestDiff*,ExampleDiff,internal/difftests, the fullgo test ./...and golangci-lint.