Reputation: 21
I use from twisted.names import dns for serving dns queries on my network.
And i want to reply with list of IP addresses for my domain ( example for 'mydomain22.com' query ) I use this sample for serving queries https://gist.github.com/johnboxall/1147973
for answer in ans:
if answer.type != dns.A:
continue
if domain['name'] not in answer.name.name:
continue
answer.payload.address = socket.inet_aton(list_of_ip) # here
answer.payload.ttl = TTL
Thanks!
Upvotes: 1
Views: 243
Reputation: 48335
I can guess that ans
is a list of RRHeader
instances (but it's sad that I had to guess, try including this sort of information in your questions in the future :) which is used to populate the answers section of the DNS message your code sends as a response.
However, it's not obvious that my guess is correct because if it were correct then you'd already be able to send back multiple answers. ans
is a list of RRHeader
instances and each of those instances will be included in the answer that is sent out. So if you'd like more answers to be sent, just add more RRHeader
instances to ans
.
And of course, if the records are more suitable as authority or additional records, then put them into one of those lists instead of into the answers list.
Upvotes: 1