arp-cache#
Read the host ARP cache to resolve IPv4 addresses to MAC addresses, in pure OCaml.
- Linux: reads
/proc/net/arpdirectly - macOS/BSD: parses the output of
arp -a
The line parsers (parse_proc_net_arp, parse_arp_a_output) are pure; only
table, lookup and lookup_mac touch the operating system. For the ARP
wire protocol codec, see nox-arp.
Installation#
Install with opam:
$ opam install arp-cache
If opam cannot find the package, it may not yet be released in the public
opam-repository. Add the overlay repository, then install it:
$ opam repo add samoht https://tangled.org/gazagnaire.org/opam-overlay.git
$ opam update
$ opam install arp-cache
Usage#
Arp_cache.table () returns the cache as a list of { ip; mac; interface }
entries; Arp_cache.lookup_mac ip resolves a single address. See arp_cache.mli
for the full API. The bundled arp-cache command prints the table.
Licence#
MIT