Commit Graph
3 Commits
Author SHA1 Message Date
93c5ca7bba Fix short flags, AllowTCP wiring, invalid root server error, add config tests
CI / test (pull_request) Failing after 2m14s
- Register -v/-q short flag aliases sharing the same bool variable as
  --verbose/--quiet so both forms work identically
- Register -d and -dd flags; use ParseDebugLevel() helper so -d sets
  Debug=1 and -dd sets Debug=2; remove the broken strings.Count approach
- Add AllowTCP field to dns.QueryConfig; guard TCP truncation fallback in
  QueryWithExchange and IterativeQueryWithExchange behind cfg.AllowTCP;
  wire cfg.AllowTCP from CLI config into QueryConfig in main.go
- ParseRootServer() now returns ErrInvalidRootServer instead of (nil,nil)
  when the string is non-empty but net.ParseIP fails
- Add internal/config/config_test.go covering ParseQueryType, ParseUDPSize,
  Validate, GetDomain, ParseRootServer, ParseDebugLevel, and the
  --always-tcp/--allow-tcp cross-check
- Add TestQueryNoTCPFallbackWhenDisabled to dns/query_test.go
- Update existing truncation tests to set AllowTCP:true
- Add TODO comments on display flags not yet wired to output layer

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: multica-agent <github@multica.ai>
2026-06-08 01:29:46 +10:00
Garyandmultica-agent d66dcbe067 feat: implement CLI flags and configuration handling (HAN-382)
CI / test (pull_request) Waiting to run
- Created internal/config/config.go with Config struct containing all 15 CLI flags
- Added ParseQueryType() for validating record types (A, AAAA, NS, CNAME, MX, TXT, SOA, PTR, ANY)
- Added ParseUDPSize() with validation (512-4096)
- Added ParseMaxDepth() with validation (1-100)
- Added ParseRetries() with validation (0-10)
- Added Validate() for cross-field validation (e.g., --always-tcp requires --allow-tcp)
- Added GetDomain() for validating the required positional argument
- Added PrintUsage() displaying all flags with --no- variants for display options
- Updated cmd/exploredns/main.go with flag definitions using the standard flag package
- Proper flag parsing and config population
- Manual parsing of debug level (supports -dd)
- Support for --no-* display flags (e.g., --no-show-progress)
- Config validation before execution
- Integration with traversal engine using dns.QueryConfig and traverse.TraverserConfig
- Clean error handling with descriptive messages

All flags implemented:
- --type TYPE (default A)
- --root-server HOST
- --all-root-servers
- --root-aaaa
- --follow-aaaa
- --udp-size SIZE (default 2048)
- --allow-tcp (default true)
- --always-tcp
- --max-depth DEPTH (default 20)
- --retries TIMES (default 2)
- --fast (default true)
- --verbose, -v
- --debug, -d (stackable: -dd)
- --quiet, -q
- --show-progress, --no-show-progress
- --show-resolves, --no-show-resolves
- --show-servers, --no-show-servers
- --show-versions, --no-show-versions
- --show-all-stats, --no-show-all-stats
- --show-results, --no-show-results
- --show-summary-results, --no-show-summary-results

Validation: Invalid inputs produce clear error messages, exploredns --help displays usage with all options, all existing tests pass
Co-authored-by: multica-agent <github@multica.ai>
2026-06-07 16:36:48 +10:00
Garyandmultica-agent 8090182e1a feat: Go project scaffolding - module init, directory structure, CLI skeleton, Makefile, CI
CI / build (pull_request) Failing after 3h1m44s
Co-authored-by: multica-agent <github@multica.ai>
2026-06-05 15:08:29 +10:00