Pure UDP DNS event projection and bounded ordered-stream correlation.
Pure UDP DNS event projection and bounded ordered-stream correlation.
(advance state watermark-us)Advance a monotonic integer watermark. Expire pending at deadline <= watermark as :timeout events (deadline/key order); release quarantine at until <= watermark. No implicit expiry on unrelated input, no unbounded output/history retention.
Advance a monotonic integer watermark. Expire pending at deadline <= watermark as :timeout events (deadline/key order); release quarantine at until <= watermark. No implicit expiry on unrelated input, no unbounded output/history retention.
(finish state)Emit :unfinished queries in deadline/key order; clear pending and retired. Idempotent and terminal. Does not fabricate responses, timeouts or a watermark.
Emit :unfinished queries in deadline/key order; clear pending and retired. Idempotent and terminal. Does not fabricate responses, timeouts or a watermark.
(init {:keys [timeout-us max-pending max-retired reuse-delay-us] :as opts})Create bounded immutable state. Requires positive integer :timeout-us, :max-pending and :max-retired. :reuse-delay-us defaults to timeout (positive). Pending queries expire at first time+timeout. Retired keys remain quarantined until that deadline+reuse delay, released only by an explicit watermark.
Create bounded immutable state. Requires positive integer :timeout-us, :max-pending and :max-retired. :reuse-delay-us defaults to timeout (positive). Pending queries expire at first time+timeout. Retired keys remain quarantined until that deadline+reuse delay, released only by an explicit watermark.
(packet->event packet)Project existing full-decode DNS data to EDN, or nil for ineligible packets. Supports unfragmented standard UDP/53 messages with 0 or 1 question. Reject decode-error, any diagnostics, unsupported linktype, short DNS/UDP, fragments and unsupported opcodes. Reuses parsed headers, never reads bytes. Optional dns-ext annotation supplies question fields. Eligible bad timestamps throw :invalid-time. Missing questions remain events for explicit ambiguity.
Project existing full-decode DNS data to EDN, or nil for ineligible packets. Supports unfragmented standard UDP/53 messages with 0 or 1 question. Reject decode-error, any diagnostics, unsupported linktype, short DNS/UDP, fragments and unsupported opcodes. Reuses parsed headers, never reads bytes. Optional dns-ext annotation supplies question fields. Eligible bad timestamps throw :invalid-time. Missing questions remain events for explicit ambiguity.
(packet-time-us {:keys [ts-sec ts-usec]})Convert native :ts-sec/:ts-usec to exact integer epoch microseconds. Seconds may be negative; usec must be 0..999999. No legacy/clock fallback. Missing/noninteger components throw :invalid-time; arithmetic promotes.
Convert native :ts-sec/:ts-usec to exact integer epoch microseconds. Seconds may be negative; usec must be 0..999999. No legacy/clock fallback. Missing/noninteger components throw :invalid-time; arithmetic promotes.
(step state input)Process a normalized DNS event; return {:state map :events vector}. Missing question fields emit :ambiguous-question. Responses before queries emit :unmatched-response and are not retained. Identical pending queries are retries: RTT uses earliest query time; retries never extend timeout. Different questions have distinct keys. Retired-key reuse emits :id-reuse, without a pair. Events before watermark emit :late-event. Negative RTT emits :negative-rtt; responses at/after deadline emit :timeout and :unmatched-response. Bound errors throw ex-info, leaving the original state unchanged. Unknown keys are dropped.
Process a normalized DNS event; return {:state map :events vector}.
Missing question fields emit :ambiguous-question. Responses before queries
emit :unmatched-response and are not retained. Identical pending queries are
retries: RTT uses earliest query time; retries never extend timeout. Different
questions have distinct keys. Retired-key reuse emits :id-reuse, without a pair.
Events before watermark emit :late-event. Negative RTT emits :negative-rtt;
responses at/after deadline emit :timeout and :unmatched-response. Bound errors
throw ex-info, leaving the original state unchanged. Unknown keys are dropped.cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |