i'm... going to re-do this.
This commit is contained in:
parent
363cdc712e
commit
a0d5071a8d
@ -11,8 +11,43 @@ from lxml import etree
|
||||
from pyroute2 import IPRoute
|
||||
##
|
||||
from . import tunnel
|
||||
from . import radvd
|
||||
from . import utils
|
||||
|
||||
|
||||
def create_default_cfg():
|
||||
# Create a stripped sample config.
|
||||
nsmap = {None: 'https://tunnelbroker.net/',
|
||||
'xsi': 'http://www.w3.org/2001/XMLSchema-instance'}
|
||||
attr_qname = etree.QName('http://www.w3.org/2001/XMLSchema-instance', 'schemaLocation')
|
||||
schema_url = 'http://schema.xml.r00t2.io/projects/he_ipv6.xsd'
|
||||
schema_loc = '{0} {1}'.format(nsmap[None], schema_url)
|
||||
xml = etree.Element('heIPv6',
|
||||
{attr_qname: schema_loc},
|
||||
nsmap = nsmap)
|
||||
xml.append(etree.Comment(('See example.tunnelbroker.xml for an extensively commented sample config.')))
|
||||
creds = etree.SubElement(xml, 'creds')
|
||||
creds.append(etree.Comment(('Your tunnelbroker.net *login*. You can specify multiple credentials via multiple '
|
||||
'"cred" items. The "id" attribute is up to you but it must be unique.')))
|
||||
cred = etree.SubElement(creds, 'cred')
|
||||
cred.attrib['id'] = ''
|
||||
user = etree.SubElement(cred, 'user')
|
||||
user.text = ''
|
||||
password = etree.SubElement(cred, 'password')
|
||||
password.text = ''
|
||||
tunnels = etree.SubElement(xml, 'tunnels')
|
||||
tunnels.append(etree.Comment(('You can have define multiple tunnels via multiple "tunnel" items. You should most '
|
||||
'likely only run one at a time.')))
|
||||
tunnel = etree.SubElement(tunnels, 'tunnel')
|
||||
tunnel.append(etree.Comment(('The "id" attribute should match the id number of a tunnel on your tunnelbroker.net '
|
||||
'account. The "creds" attribute references a cred item id attribute.')))
|
||||
tunnel.attrib['id'] = ''
|
||||
tunnel.attrib['creds'] = ''
|
||||
ukey = etree.SubElement(tunnel, '')
|
||||
return (etree.tostring(xml,
|
||||
encoding = 'UTF-8',
|
||||
xml_declaration = True,
|
||||
pretty_print = True,
|
||||
with_tail = True,
|
||||
with_comments = True))
|
||||
|
||||
|
||||
class Credential(object):
|
||||
|
Loading…
Reference in New Issue
Block a user