1
0
Fork 0
mirror of https://github.com/NeoCloud/NeoNetwork synced 2024-11-22 16:40:41 +08:00

roa.py: add free cidr range

This commit is contained in:
JerryXiao 2021-09-26 22:26:59 +08:00
parent ccd7569a31
commit ff7e443232
Signed by: Jerry
GPG key ID: 22618F758B5BE2E5

View file

@ -392,6 +392,7 @@ def make_summary():
print(route_table) print(route_table)
print() print()
print("## Used CIDR Range") print("## Used CIDR Range")
print("<details>\n<summary>Click to expand</summary>")
print() print()
prefixes = netaddr.cidr_merge( prefixes = netaddr.cidr_merge(
netaddr.IPNetwork(str(entity["prefix"])) netaddr.IPNetwork(str(entity["prefix"]))
@ -401,6 +402,17 @@ def make_summary():
for prefix in prefixes: for prefix in prefixes:
print(prefix) print(prefix)
print("```") print("```")
print("</details>")
free_netset = netaddr.IPSet([str(n) for n in NEO_NETWORK_POOL]) - netaddr.IPSet(prefixes)
print()
print("## Free CIDR Range")
print("<details>\n<summary>Click to expand</summary>")
print()
print("```")
for prefix in free_netset.iter_cidrs():
print(prefix)
print("```")
print("</details>")
IP_VRSIONS = {4, 6} IP_VRSIONS = {4, 6}
total_ip_count = { total_ip_count = {
ver: sum( ver: sum(