|
@@ -26,6 +26,7 @@ class BatcaveHttpRequestHandler(BaseHTTPRequestHandler):
|
|
|
|
|
|
# check all entries for a proper 'remote' entry
|
|
|
vpn = self.server.storage.data[self.DATAKEY_VPN]
|
|
|
+ init_vpn_cache = {}
|
|
|
for key in vpn:
|
|
|
if not isinstance(vpn[key], dict):
|
|
|
continue
|
|
@@ -38,10 +39,17 @@ class BatcaveHttpRequestHandler(BaseHTTPRequestHandler):
|
|
|
item = vpn[key][mode][gw]
|
|
|
if 'remote' in item and not 'remote_raw' in item:
|
|
|
item['remote_raw'] = item['remote']
|
|
|
- resolved = ffstatus.resolve_ipblock(item['remote'])
|
|
|
+ resolved = None
|
|
|
+ if item['remote'] in init_vpn_cache:
|
|
|
+ resolved = init_vpn_cache[item['remote']]
|
|
|
+ else:
|
|
|
+ resolved = ffstatus.resolve_ipblock(item['remote'])
|
|
|
+ init_vpn_cache[item['remote']] = resolved
|
|
|
+ if not resolved is None:
|
|
|
+ self.logger.info('Startup: resolved VPN entry \'{0}\' to net \'{1}\'.'.format(item['remote'], resolved['name']))
|
|
|
if not resolved is None:
|
|
|
- self.logger.info('Startup: resolved VPN entry \'{0}\' to net \'{1}\'.'.format(item['remote'], resolved['name']))
|
|
|
item['remote'] = resolved
|
|
|
+ self.server.storage.save()
|
|
|
|
|
|
def parse_url_pathquery(self):
|
|
|
"""Extracts the query parameters from the request path."""
|