Public, data-first facade for Paclo.
Main entry points:
packets for live/offline capture as lazy sequencesreduce-packets for synchronous, low-allocation reductionbpf for BPF DSL -> string conversionwrite-pcap! for writing packet byte sequencesPublic, data-first facade for Paclo. Main entry points: - `packets` for live/offline capture as lazy sequences - `reduce-packets` for synchronous, low-allocation reduction - `bpf` for BPF DSL -> string conversion - `write-pcap!` for writing packet byte sequences
(-main & _)Repository-local convenience entrypoint. Paclo is a library; use example commands for executable workflows.
Repository-local convenience entrypoint. Paclo is a library; use example commands for executable workflows.
(bpf form)Convert a BPF DSL value into a libpcap filter string.
Accepted input:
nil -> nil:udp, :tcp, :icmp, :icmp6, :arp, :ip, :ipv4, :ip6, :ipv6):and, :or, :not, :proto, host/net/port forms)Throws ex-info for unsupported forms/operators/keywords.
Convert a BPF DSL value into a libpcap filter string. Accepted input: - `nil` -> `nil` - string -> returned as-is - keyword protocol (`:udp`, `:tcp`, `:icmp`, `:icmp6`, `:arp`, `:ip`, `:ipv4`, `:ip6`, `:ipv6`) - vector DSL form (`:and`, `:or`, `:not`, `:proto`, host/net/port forms) Throws `ex-info` for unsupported forms/operators/keywords.
(list-devices)Return available capture devices as
{:name <string> :desc <string|nil>} maps.
Return available capture devices as
`{:name <string> :desc <string|nil>}` maps.(packets {:keys [filter decode? xform] :as opts})Return packets as a lazy sequence.
Key opts:
:path (offline) or :device (live):filter: BPF string, protocol keyword, or BPF DSL vector:decode?: when true, add :decoded or :decode-error to each packet map:xform: transducer applied to output stream via sequence:queue-cap, opt-in :queue-mode :dropping, and
:on-queue-statsThrows ex-info when :filter has an unsupported type.
Return packets as a lazy sequence. Key opts: - source: `:path` (offline) or `:device` (live) - `:filter`: BPF string, protocol keyword, or BPF DSL vector - `:decode?`: when true, add `:decoded` or `:decode-error` to each packet map - `:xform`: transducer applied to output stream via `sequence` - live queue: `:queue-cap`, opt-in `:queue-mode :dropping`, and `:on-queue-stats` Throws `ex-info` when `:filter` has an unsupported type.
(reduce-packets {:keys [filter decode? decode-mode xform] :as opts} rf init)Synchronously reduce live or offline packets without an intermediate seq.
(reduce-packets opts rf init) accepts the same source, BPF, decode,
transducer, stopping, and error options as packets. The transducer in
:xform is fused into the reducing function. Returning reduced from rf
stops capture immediately.
Synchronously reduce live or offline packets without an intermediate seq. `(reduce-packets opts rf init)` accepts the same source, BPF, decode, transducer, stopping, and error options as `packets`. The transducer in `:xform` is fused into the reducing function. Returning `reduced` from `rf` stops capture immediately.
(write-pcap! packets out)Write packet bytes to a PCAP file.
packets can contain:
byte-array:bytes and optional :sec/:usec timestampsWrite packet bytes to a PCAP file. `packets` can contain: - `byte-array` - map with `:bytes` and optional `:sec`/`:usec` timestamps
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 |