CI / test (pull_request) Failing after 2m13s
- Rewrite README.md with overview, features, installation (go install +
build from source), quick start, full CLI flag reference table,
output section descriptions, project structure, and development guide
- Add package-level doc comments to all five internal packages:
config, dns, fingerprint, output, traverse (via doc.go or existing
package-declaration files)
- Add GoDoc comments on every exported type, constant, function, and
method across all packages:
- internal/config: Config struct fields, all Parse*/Default/Validate
- internal/dns: QueryConfig, Resolver, BasicResolver, CachingResolver,
ExchangeFunc, RootServer, RootDiscoveryConfig, DecodedResponse,
ResponseClassification, all exported helpers
- internal/fingerprint: Fingerprinter, New, NewWithTimeout, Query,
FingerprintAll
- internal/traverse: Traverser, TraverserConfig, TraversalResult,
Referral, ResolutionState, Response, ResponseType, InfoCache,
Stack, TraverserHooks, EventStage, TraversalEvent, EventHandler,
CircularReferralError, UnresolvableNameserverError
- internal/output: Format, Config, Formatter, SummaryStats,
NewFormatter, AttachHooks, RunTraversal, DefaultConfig,
ComputeSummary
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: multica-agent <github@multica.ai>
44 lines
1.3 KiB
Go
44 lines
1.3 KiB
Go
package traverse
|
|
|
|
// EventStage indicates whether a TraversalEvent is fired at the start or
|
|
// completion of processing a Referral.
|
|
type EventStage int
|
|
|
|
// Event stage constants.
|
|
const (
|
|
EventStart EventStage = iota // fired when a Referral is about to be queried
|
|
EventComplete // fired after the Response has been produced
|
|
)
|
|
|
|
// TraversalEvent carries context for a single traversal event delivered to
|
|
// the OnEvent hook.
|
|
type TraversalEvent struct {
|
|
// Stage is EventStart or EventComplete.
|
|
Stage EventStage
|
|
// Result carries the Referral and (for EventComplete) the Response.
|
|
Result TraversalResult
|
|
// IsResolve is true when the event relates to a nameserver address
|
|
// resolution sub-traversal rather than the main traversal.
|
|
IsResolve bool
|
|
}
|
|
|
|
// EventHandler is the function signature for traversal event callbacks.
|
|
type EventHandler func(TraversalEvent)
|
|
|
|
// TraverserHooks holds the optional event callback for a Traverser.
|
|
// Assigning OnEvent enables progress and result notifications.
|
|
type TraverserHooks struct {
|
|
OnEvent EventHandler
|
|
}
|
|
|
|
func (h *TraverserHooks) emit(stage EventStage, result TraversalResult, isResolve bool) {
|
|
if h == nil || h.OnEvent == nil {
|
|
return
|
|
}
|
|
h.OnEvent(TraversalEvent{
|
|
Stage: stage,
|
|
Result: result,
|
|
IsResolve: isResolve,
|
|
})
|
|
}
|