paulc / dnslib

A Python library to encode/decode DNS wire-format packets
https://github.com/paulc/dnslib
BSD 2-Clause "Simplified" License
299 stars 85 forks source link

Accessing request ip in resolve() #15

Closed brunobg closed 4 years ago

brunobg commented 4 years ago

Is it possible to get the request IP in resolve()? The use case is that I'm running a small DNS server for a domain, and I noticed it's being used as a full DNS server by somebody. I want to resolve any requests to *.mydomain.com for any IP except for a whitelist.

ceccun commented 4 years ago

handler.client_address[0] should do the job, assuming it's layed out like resolve(self, request, **handler**):