contrib: (asmap) add docs about encode and decode commands

This commit is contained in:
jurraca 2025-03-12 17:52:07 +00:00
parent 67d5cc2a06
commit 6afffba34e

View file

@ -15,6 +15,31 @@ These commands may take a few minutes to run with `python3`,
depending on the amount of data involved and your machine specs.
Consider using `pypy3` for a faster run time.
### Encoding and Decoding
ASmap files are somewhat large in text form, and need to be encoded
to binary before being used with Bitcoin Core.
The `encode` command takes an ASmap and an output file.
The `--fill`/`-f` flag further reduces the size of the output file
by assuming an AS assignment for an unmapped network if an adjacent network is assigned.
This procedure is lossy, in the sense that it loses information
about which ranges were unassigned.
However, if the input ASmap is incomplete,
this procedure will also reassign ranges that should have an AS assignment,
resulting in an ASmap that may diverge from reality significantly.
Finally, another consequence is that the resulting encoded file
will no longer be meaningful for diffs.
Therefore only use `--fill` if
you want to optimise space, you have a reasonably complete ASmap,
and do not intend to diff the file at a later time.
The `decode` command takes an encoded ASmap and an output file.
As with `encode`, the `--fill`/`-f` flag reduces the output file size
by reassigning subnets. Conversely, the `--non-overlapping`/`-n` flag
increases output size by outputting strictly non-overlapping network ranges.
### Comparing ASmaps
AS control of IP networks changes frequently, therefore it can be useful to get