From 641276272fc0ee0695f68fc15d84efee18155980 Mon Sep 17 00:00:00 2001 From: Michael Kuron Date: Sun, 2 Aug 2020 22:40:58 +0200 Subject: [PATCH] SRV with additional --- proxy.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/proxy.py b/proxy.py index 6bb984c..1910d4c 100644 --- a/proxy.py +++ b/proxy.py @@ -6,6 +6,7 @@ import time from twisted.internet import reactor, defer, threads from twisted.names import client, dns, error, server from twisted.python import log +import socket domain = sys.argv[1] port = int(sys.argv[2]) @@ -60,18 +61,18 @@ class DynamicResolver(object): answers = [dns.RRHeader(name=query.name.name, ttl=ttl, type=dns.SRV, payload=dns.Record_SRV( info.priority, info.weight, info.port, info.server[:-6] + domain ))] + additional = [dns.RRHeader(name=info.server[:-6] + domain, ttl=ttl, type=dns.A, payload=dns.Record_A( + socket.inet_ntop(socket.AF_INET, addr) + )) for addr in info.addresses] - print(answers) - - return answers, [], [] + return answers, [], additional def host(localname): + answers = [dns.RRHeader(name=query.name.name, ttl=ttl, type=dns.A, payload=dns.Record_A( "192.0.2.1" # TODO ))] - print(answers) - return answers, [], [] d = defer.Deferred()