Skip to content

Commit 67d5cc2

Browse files
committed
contrib: (asmap) add documentation on diff and diff-addrs commands
1 parent e047b1d commit 67d5cc2

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

contrib/asmap/README.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,48 @@ python3 asmap-tool.py decode /path/to/input.file /path/to/output.file
1111
python3 asmap-tool.py diff /path/to/first.file /path/to/second.file
1212
python3 asmap-tool.py diff-addrs /path/to/first.file /path/to/second.file addrs.file
1313
```
14+
These commands may take a few minutes to run with `python3`,
15+
depending on the amount of data involved and your machine specs.
16+
Consider using `pypy3` for a faster run time.
17+
18+
### Comparing ASmaps
19+
20+
AS control of IP networks changes frequently, therefore it can be useful to get
21+
the changes between to ASmaps via the `diff` and `diff_addrs` commands.
22+
23+
`diff` takes two ASmap files, and returns a file detailing the changes
24+
in the state of a network's AS assignment between the first and the second file.
25+
This command may take a few minutes to run, depending on your machine.
26+
27+
The example below shows the three possible output states:
28+
- reassigned to a new AS (`AS26496 # was AS20738`),
29+
- present in the first but not the second (`# 220.157.65.0/24 was AS9723`),
30+
- or present in the second but not the first (`# was unassigned`).
31+
32+
```
33+
217.199.160.0/19 AS26496 # was AS20738
34+
# 220.157.65.0/24 was AS9723
35+
216.151.172.0/23 AS400080 # was unassigned
36+
2001:470:49::/48 AS20205 # was AS6939
37+
# 2001:678:bd0::/48 was AS207631
38+
2001:67c:308::/48 AS26496 # was unassigned
39+
```
40+
`diff` accepts a `--ignore-unassigned`/`-i` flag
41+
which ignores networks present in the second but not the first.
42+
43+
`diff_addrs` is intended to provide changes between two ASmaps and
44+
a node's known peers.
45+
The command takes two ASmap files, and a file of IP addresses as output by
46+
the `bitcoin-cli getnodeaddresses` command.
47+
It returns the changes between the two ASmaps for the peer IPs provided in
48+
the `getnodeaddresses` output.
49+
The resulting file is in the same format as the `diff` command shown above.
50+
51+
You can output address data to a file:
52+
```
53+
bitcoin-cli getnodeaddresses 0 > addrs.json
54+
```
55+
and pass in the address file as the third argument:
56+
```
57+
python3 asmap-tool.py diff_addrs path/to/first.file path/to/second.file addrs.json
58+
```

0 commit comments

Comments
 (0)