From cf51e968525dee523c9f10e485a88612c5fb0dfc Mon Sep 17 00:00:00 2001 From: brent s Date: Fri, 15 May 2020 01:40:42 -0400 Subject: [PATCH] so it turns out it returns the same structure, just with a single child. i can probably just use the general HEConf then and wrap it? --- utils/he_ipv6/args.py | 2 +- utils/he_ipv6/config.py | 17 +++++++++-------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/utils/he_ipv6/args.py b/utils/he_ipv6/args.py index 116c613..0f99d27 100644 --- a/utils/he_ipv6/args.py +++ b/utils/he_ipv6/args.py @@ -12,7 +12,7 @@ def parseArgs(): args.add_argument('-c', '--config', dest = 'conf_xml', default = '~/.config/he_tunnelbroker.xml', - help = ('The path to the config. See example.tunnelbroker.xml' + help = ('The path to the config. See example.tunnelbroker.xml ' 'Default: ~/.config/he_tunnelbroker.xml')) args.add_argument('-t', '--tunnel-id', dest = 'tun_id', diff --git a/utils/he_ipv6/config.py b/utils/he_ipv6/config.py index a306f8b..d6e91b2 100644 --- a/utils/he_ipv6/config.py +++ b/utils/he_ipv6/config.py @@ -266,37 +266,38 @@ class HETunnelConfig(HEBaseConfig): self.my_ip = None # Client IPv4 (not necessary; we locally cache Tunnel.my_ip) self.allocations = {} # keys are 64 and 48 self.rdns = [] # Also not necessary, but it's in the XML so why not. + self.tun_xml = self.xml.find('tunnel') # Will only return a single for this URL. self.parse() def _alloc(self): for a in ('64', '48'): - _alloc = self.xml.find('routed{0}'.format(a)) + _alloc = self.tun_xml.find('routed{0}'.format(a)) if _alloc is not None and _alloc.text.strip() != '': self.allocations[int(a)] = tunnel.Allocation(_alloc.text.strip()) return(None) def _client(self): - _client = self.xml.find('clientv4').text + _client = self.tun_xml.find('clientv4').text if _client is not None and _client.strip() != '': self.client = tunnel.IP4(_client.strip(), 32) return(None) def _desc(self): - _desc = self.xml.find('description').text + _desc = self.tun_xml.find('description').text if _desc is not None and _desc.strip() != '': self.description = _desc.strip() return(None) def _endpoint(self): - self.endpoint = tunnel.IP4(self.xml.find('serverv4').text.strip(), 32) + self.endpoint = tunnel.IP4(self.tun_xml.find('serverv4').text.strip(), 32) return(None) def _id(self): - self.id = int(self.xml.attrib['id']) + self.id = int(self.tun_xml.attrib['id']) return(None) def _my_ip(self): - _ip = self.xml.find('clientv4').text + _ip = self.tun_xml.find('clientv4').text if _ip is not None and _ip.strip() != '': self.my_ip = tunnel.IP4(_ip.strip(), 32) return(None) @@ -304,14 +305,14 @@ class HETunnelConfig(HEBaseConfig): def _rdns(self): self.rdns = [] for r in range(1, 6): - _rdns = self.xml.find('rdns{0}'.format(r)) + _rdns = self.tun_xml.find('rdns{0}'.format(r)) if _rdns is not None and _rdns.text.strip() != '': self.rdns.append(_rdns.text.strip()) self.rdns = tuple(self.rdns) return(None) def _server(self): - self.server = tunnel.IP6(self.xml.find('serverv6'), 128) + self.server = tunnel.IP6(self.tun_xml.find('serverv6'), 128) return(None) def parse(self):