On 20 Oct, 07:50 pm, [email protected] wrote: >Hi Guys, > >Im playing with a dns-cache script, that overrides DNS requests for >certain >IP addresses. > >I would like to add functionality, so unresolved requests are sent to a >spicific IP. How do I go about doing that? > >Is there a negative answer in the (udp) DNS protocol or am I forced to >use a >timeout.
You've overridden writeMessage to inspect messages for answers and rewrite them if necessary. You can recognize error responses by looking at the rCode attribute of the message object itself. This will take on a value like dns.OK, dns.EFORMAT, dns.ESERVER, dns.ENAME, dns.ENOTIMP, or dns.EREFUSED. You can handle these errors by making a request of another domain, although since writeMessage is a very low-level API in the process and not really intended to be overridden, I'm not sure how you'll insert the responses you get from these new requests into the original request/response process. Jean-Paul _______________________________________________ Twisted-Python mailing list [email protected] http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
