Commit 43334809 authored by Łukasz Nowak's avatar Łukasz Nowak

XXX-DIRTY: dns: support port for a nameserver

XXX-DIRTY:
 * it's unknown how nameservers shall be defined in surykatka, thus urlparse was used,
   to have it available like 127.0.0.1:5353 or [::1]:5454
parent d900458e
......@@ -17,6 +17,7 @@
# See COPYING file for full licensing terms.
# See https://www.nexedi.com/licensing for rationale and options.
import urllib
from dns import (
resolver as dns_resolver,
name as dns_name,
......@@ -96,7 +97,9 @@ def logDnsQuery(db, status_id, resolver_ip, domain_text, rdtype, answer_list):
def buildResolver(resolver_ip, timeout):
resolver = dns_resolver.Resolver(configure=False)
resolver.nameservers.append(resolver_ip)
resolver_ip_parsed = urllib.parse.urlparse('dns://' + resolver_ip)
resolver.nameservers.append(resolver_ip_parsed.hostname)
resolver.nameserver_ports[ip] = resolver_ip_parsed.port
resolver.timeout = timeout
resolver.lifetime = timeout
resolver.edns = -1
......
Markdown is supported
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