Commit 661c1a7e authored by Alexandre's avatar Alexandre
Browse files

Move functions around

parent ff85f6fe
......@@ -183,29 +183,6 @@ class CustomException(Exception):
pass
def create_request(dot=dot, trunc=False, **req_args):
if dot:
request = RequestDoT(**req_args)
else:
request = RequestDoH(**req_args)
if trunc:
request.trunc_data()
else:
request.to_wire()
return request
def create_requests_list(dot=dot, **req_args):
requests = []
if dot:
requests.append(('Test 1', create_request(dot=dot, **req_args)))
requests.append(('Test 2', create_request(dot=dot, **req_args)))
else:
requests.append(('Test GET', create_request(**req_args), DOH_GET))
requests.append(('Test POST', create_request(**req_args), DOH_POST))
requests.append(('Test HEAD', create_request(**req_args), DOH_HEAD))
return requests
class Request:
def __init__(self, qname, qtype=rtype, use_edns=edns, want_dnssec=dnssec):
self.message = dns.message.make_query(qname, dns.rdatatype.from_text(qtype), use_edns=use_edns, want_dnssec=want_dnssec)
......@@ -550,6 +527,27 @@ def print_result(connection, request, prefix=None):
ok = False
return ok
def create_request(dot=dot, trunc=False, **req_args):
if dot:
request = RequestDoT(**req_args)
else:
request = RequestDoH(**req_args)
if trunc:
request.trunc_data()
else:
request.to_wire()
return request
def create_requests_list(dot=dot, **req_args):
requests = []
if dot:
requests.append(('Test 1', create_request(dot=dot, **req_args)))
requests.append(('Test 2', create_request(dot=dot, **req_args)))
else:
requests.append(('Test GET', create_request(**req_args), DOH_GET))
requests.append(('Test POST', create_request(**req_args), DOH_POST))
requests.append(('Test HEAD', create_request(**req_args), DOH_HEAD))
return requests
def run_check_default(connection):
ok = True
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment