-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpeering_gossip.py
executable file
·54 lines (43 loc) · 1.2 KB
/
peering_gossip.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/usr/bin/env python3
"""
Peering Gossip - Gossiping about bad practices!
"""
import argparse
import asyncio
import sys
from pgossip.pgossip import PGossip
async def main():
"""Peering Gossip"""
parser = argparse.ArgumentParser(
description="Peering Gossip - Gossiping about bad practices!"
)
parser.add_argument(
"-lg",
action="store",
dest="lg",
metavar="ALICE_URL",
help="Check Alice looking glass for top filtered ASNs, and generates a report.",
)
parser.add_argument(
"-a",
action="store_true",
dest="all",
help="Generate report for all ixps from pgossip/config.yaml.",
)
args = parser.parse_args()
options = all(value is True for value in vars(args).values())
pgossip = PGossip()
if args.lg:
await pgossip.alice_host(args.lg)
if args.all:
ixps = pgossip.load_yaml()
await pgossip.process_all_ixps_concurrently(ixps)
if not options:
if len(sys.argv) == 1:
parser.print_help(sys.stderr)
sys.exit(0)
if __name__ == "__main__":
try:
asyncio.run(main())
except KeyboardInterrupt:
print("Interrupted")