-
Notifications
You must be signed in to change notification settings - Fork 17
/
ext-respondd.py
executable file
·49 lines (38 loc) · 1.32 KB
/
ext-respondd.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
#!/usr/bin/env python3
import json
import argparse
import sys
from lib.respondd_client import ResponddClient
import lib.helper
parser = argparse.ArgumentParser()
parser.add_argument('-d', '--test', action='store_true', help='Test Output', required=False)
parser.add_argument('-v', '--verbose', action='store_true', help='Verbose Output', required=False)
parser.add_argument('-t', '--dry-run', action='store_true', help='Dry Run', required=False)
args = parser.parse_args()
options = vars(args)
config = {
'bridge': 'br-client',
'batman': 'bat0',
'port': 1001,
'addr': 'ff05::2:1001',
'caching': 5,
'rate_limit': 30,
'rate_limit_burst': 10
}
try:
with open("config.json", 'r') as fh:
config = lib.helper.merge(config, json.load(fh))
except IOError:
print('no config.json, use defaults')
if options["test"]:
from lib.nodeinfo import Nodeinfo
from lib.statistics import Statistics
from lib.neighbours import Neighbours
print(json.dumps(Nodeinfo(config).getStruct(), sort_keys=True, indent=4))
print(json.dumps(Statistics(config).getStruct(), sort_keys=True, indent=4))
print(json.dumps(Neighbours(config).getStruct(), sort_keys=True, indent=4))
sys.exit(1)
config['verbose'] = options['verbose']
config['dry_run'] = options['dry_run']
extResponddClient = ResponddClient(config)
extResponddClient.start()