mirror of
https://github.com/NeoCloud/NeoNetwork
synced 2024-11-05 18:22:26 +08:00
Regular update: 2020-07-26T12:39:26Z
This commit is contained in:
parent
dd83999da6
commit
5d7b40b9f2
2 changed files with 20 additions and 14 deletions
|
@ -12,8 +12,7 @@ mkdir -p generated
|
||||||
mkdir -p generated/dns
|
mkdir -p generated/dns
|
||||||
|
|
||||||
.scripts/dns-reverse-generator.py
|
.scripts/dns-reverse-generator.py
|
||||||
cp dns/db.10.127 generated/dns
|
cp -R dns/* generated/dns
|
||||||
cp dns/db.fd10.127 generated/dns
|
|
||||||
|
|
||||||
.scripts/roa.py -m "$MAX_LEN_4" -M "$MAX_LEN_6" -o generated/roa46_bird2.conf
|
.scripts/roa.py -m "$MAX_LEN_4" -M "$MAX_LEN_6" -o generated/roa46_bird2.conf
|
||||||
.scripts/roa.py -m "$MAX_LEN_4" -M "$MAX_LEN_6" -4 -o generated/roa4_bird2.conf
|
.scripts/roa.py -m "$MAX_LEN_4" -M "$MAX_LEN_6" -4 -o generated/roa4_bird2.conf
|
||||||
|
|
|
@ -109,7 +109,10 @@ def route_to_roa(asn_table: dict):
|
||||||
)
|
)
|
||||||
assert fields["name"]
|
assert fields["name"]
|
||||||
assert is_neo_network(fields["prefix"])
|
assert is_neo_network(fields["prefix"])
|
||||||
assert not fields["supernet"] or (is_neo_network(fields["supernet"]) and fields["supernet"].supernet_of(fields["prefix"]))
|
assert not fields["supernet"] or (
|
||||||
|
is_neo_network(fields["supernet"])
|
||||||
|
and fields["supernet"].supernet_of(fields["prefix"])
|
||||||
|
)
|
||||||
yield pick(fields, ["asn", "name", "type", "prefix", "supernet"])
|
yield pick(fields, ["asn", "name", "type", "prefix", "supernet"])
|
||||||
|
|
||||||
entities = sorted(make_route(), key=lambda item: item["asn"])
|
entities = sorted(make_route(), key=lambda item: item["asn"])
|
||||||
|
@ -245,7 +248,9 @@ def make_summary():
|
||||||
node_table = node_to_asn(set(asn_table.keys()))
|
node_table = node_to_asn(set(asn_table.keys()))
|
||||||
stream = StringIO()
|
stream = StringIO()
|
||||||
with redirect_stdout(stream):
|
with redirect_stdout(stream):
|
||||||
print("Entity table:")
|
print("# NeoNetwork Summary")
|
||||||
|
print()
|
||||||
|
print("## Entity table")
|
||||||
entity_table = tabulate(
|
entity_table = tabulate(
|
||||||
(
|
(
|
||||||
(
|
(
|
||||||
|
@ -256,33 +261,33 @@ def make_summary():
|
||||||
for entity in entities.values()
|
for entity in entities.values()
|
||||||
),
|
),
|
||||||
headers=["Name", "Email", "Telegram"],
|
headers=["Name", "Email", "Telegram"],
|
||||||
tablefmt="presto",
|
tablefmt="github",
|
||||||
)
|
)
|
||||||
print(entity_table)
|
print(entity_table)
|
||||||
print()
|
print()
|
||||||
print("AS table:")
|
print("## AS table")
|
||||||
as_table = tabulate(
|
as_table = tabulate(
|
||||||
(
|
(
|
||||||
(entity["source"], "AS{}".format(asn), entity["owner"], entity["name"])
|
(entity["source"], "AS{}".format(asn), entity["owner"], entity["name"])
|
||||||
for asn, entity in sorted(asn_table.items(), key=lambda item: item[0])
|
for asn, entity in sorted(asn_table.items(), key=lambda item: item[0])
|
||||||
),
|
),
|
||||||
headers=["Source", "ASN", "Owner", "Name"],
|
headers=["Source", "ASN", "Owner", "Name"],
|
||||||
tablefmt="presto",
|
tablefmt="github",
|
||||||
)
|
)
|
||||||
print(as_table)
|
print(as_table)
|
||||||
print()
|
print()
|
||||||
print("Node table:")
|
print("## Node table")
|
||||||
node_table = tabulate(
|
node_table = tabulate(
|
||||||
(
|
(
|
||||||
("AS{}".format(asn), name)
|
("AS{}".format(asn), name)
|
||||||
for name, asn in sorted(node_table.items(), key=lambda item: item[1])
|
for name, asn in sorted(node_table.items(), key=lambda item: item[1])
|
||||||
),
|
),
|
||||||
headers=["ASN", "Name"],
|
headers=["ASN", "Name"],
|
||||||
tablefmt="presto",
|
tablefmt="github",
|
||||||
)
|
)
|
||||||
print(node_table)
|
print(node_table)
|
||||||
print()
|
print()
|
||||||
print("Peer table:")
|
print("## Peer table")
|
||||||
peer_table = tabulate(
|
peer_table = tabulate(
|
||||||
(
|
(
|
||||||
(item.stem, downstream)
|
(item.stem, downstream)
|
||||||
|
@ -290,12 +295,12 @@ def make_summary():
|
||||||
for downstream in entity["to-peer"]
|
for downstream in entity["to-peer"]
|
||||||
),
|
),
|
||||||
headers=["Upstream", "Downstream"],
|
headers=["Upstream", "Downstream"],
|
||||||
tablefmt="presto",
|
tablefmt="github",
|
||||||
colalign=("right",),
|
colalign=("right",),
|
||||||
)
|
)
|
||||||
print(peer_table)
|
print(peer_table)
|
||||||
print()
|
print()
|
||||||
print("Route table:")
|
print("## Route table")
|
||||||
route_table = tabulate(
|
route_table = tabulate(
|
||||||
(
|
(
|
||||||
(
|
(
|
||||||
|
@ -308,17 +313,19 @@ def make_summary():
|
||||||
for entity in route_to_roa(asn_table)
|
for entity in route_to_roa(asn_table)
|
||||||
),
|
),
|
||||||
headers=["ASN", "Name", "Type", "Prefix", "Supernet"],
|
headers=["ASN", "Name", "Type", "Prefix", "Supernet"],
|
||||||
tablefmt="presto",
|
tablefmt="github",
|
||||||
)
|
)
|
||||||
print(route_table)
|
print(route_table)
|
||||||
print()
|
print()
|
||||||
print("Used CIDR Range:")
|
print("## Used CIDR Range")
|
||||||
prefixes = netaddr.cidr_merge(
|
prefixes = netaddr.cidr_merge(
|
||||||
netaddr.IPNetwork(str(entity["prefix"]))
|
netaddr.IPNetwork(str(entity["prefix"]))
|
||||||
for entity in route_to_roa(asn_table)
|
for entity in route_to_roa(asn_table)
|
||||||
)
|
)
|
||||||
|
print("```")
|
||||||
for prefix in prefixes:
|
for prefix in prefixes:
|
||||||
print(prefix)
|
print(prefix)
|
||||||
|
print("```")
|
||||||
return stream.getvalue()
|
return stream.getvalue()
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue