Skip to content

-rate and -max-queries count names, not DNS queries, so wire traffic can be 2-9x the configured limit #32

Closed

Description

@TMHSDigital

Why it matters

-rate is documented as "Max DNS queries per second across all workers", and -max-queries as "Max DNS lookups to admit". Both actually count jobs (candidate names), not DNS queries. One job sends one query per record type, per attempt. With the default -type A,AAAA, -rate 50 puts up to about 100 qps on the wire. With -type A,AAAA,CNAME -attempts 3 it is up to 450 qps, plus per-parent wildcard probes in recursive mode, which are not rate-limited at all.

Users set -rate to stay under a resolver's or a client's rate limit, often as an explicit term of an authorized engagement. Under-counting by 2-9x is the kind of error that gets a scanner IP banned or breaks rules of engagement.

Separately (ROADMAP N1), the time.Ticker gate drops ticks while workers are busy, so throughput can also fall below the requested rate.

Evidence

  • main.go:107,112: flag help text.
  • internal/scan/runner.go:281-290 and :440-446: one limiter receive per job in processJob.
  • internal/dns/resolver.go:113-144: one network lookup per type. resolver.go:170-195: retry loop.
  • internal/scan/runner.go:487 and internal/dns/resolver.go:214-215: wildcard probes bypass the limiter.
  • internal/scan/runner.go:335: admitted counts jobs.
  • README "CLI flags" table repeats both descriptions.

Suggested approach

  • Move pacing to the per-query level. Pass a limiter (a token bucket such as golang.org/x/time/rate, or a small in-house bucket to stay dependency-free) into ResolveTypes / CheckWildcard, so every wire query takes a token. A token bucket also fixes the N1 under-delivery.
  • For -max-queries, either count wire queries too, or rename the help text to "Max candidate names to test" and document the multiplier.
  • Add a test with a counting resolveHook or testdns that asserts observed qps <= rate x (1 + tolerance).

Done when

  • -rate N bounds actual DNS packets per second, retries and wildcard probes included, within a small tolerance, and a test proves it.
  • The flag help text, README and docs/index.md describe exactly what is counted.

Activity

  1. added
    bug
    priority: high
    area: dns
    area: cli
    on Oct 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: cliarea: dnsbugpriority: high

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions