move vpn flag to aliases
This commit is contained in:
parent
f380b808e1
commit
a0adb74269
|
@ -3,6 +3,7 @@
|
|||
"name" : "Meute-AP"
|
||||
},
|
||||
"8e:3d:c2:10:10:28" : {
|
||||
"name" : "holstentor"
|
||||
"name" : "holstentor",
|
||||
"vpn" : true
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,11 +30,11 @@ db = NodeDB()
|
|||
|
||||
db.import_batman(list(fileinput.input(options['batmanjson'])))
|
||||
|
||||
db.import_wikigps("http://freifunk.metameute.de/Knoten")
|
||||
|
||||
if options['aliases']:
|
||||
db.import_aliases(json.load(open(options['aliases'])))
|
||||
|
||||
db.import_wikigps("http://freifunk.metameute.de/Knoten")
|
||||
|
||||
if options['gateway']:
|
||||
db.mark_gateways(options['gateway'])
|
||||
|
||||
|
|
12
nodedb.py
12
nodedb.py
|
@ -15,6 +15,7 @@ class NodeDB:
|
|||
|
||||
# fetch list of links
|
||||
def get_links(self):
|
||||
self.update_vpn_links()
|
||||
return self.reduce_links()
|
||||
|
||||
# fetch list of nodes
|
||||
|
@ -172,6 +173,12 @@ class NodeDB:
|
|||
|
||||
node.name = alias['name']
|
||||
|
||||
if 'vpn' in alias and alias['vpn']:
|
||||
node.flags['vpn'] = True
|
||||
|
||||
for k, v in node.interfaces.items():
|
||||
node.interfaces[k].vpn = "vpn"
|
||||
|
||||
# list of macs
|
||||
# if options['gateway']:
|
||||
# mark_gateways(options['gateway'])
|
||||
|
@ -183,11 +190,8 @@ class NodeDB:
|
|||
continue
|
||||
|
||||
node.flags['gateway'] = True
|
||||
node.flags['vpn'] = True
|
||||
|
||||
for k, v in node.interfaces.items():
|
||||
node.interfaces[k].vpn = "vpn"
|
||||
|
||||
def update_vpn_links(self):
|
||||
changes = 1
|
||||
while changes > 0:
|
||||
changes = 0
|
||||
|
|
Loading…
Reference in a new issue