[Twisted-Python] Domain Filter Suggestions

Charles Moad cmoad at indiana.edu
Mon Apr 18 11:21:22 EDT 2005

	I am working on a soap service that I am wanting to implement a domain
filter on.  Basically, if I get an IP I do not know, I defer a reverse
dns lookup and accept their request.  The defer does the reverse dns
lookup and records whether they were a .edu or not.  If I get another
request from the same IP I reject or accept their request based on the
previous lookup.
	I have an implementation that is pretty much working, but for some
lookups I get an error since the machine does not have ipv6 enabled.
(Why is this a dependency?)  Here is a little code based on previous
postings on rdns.

from twisted.names import client

addr = '' # any ip goes here
ptr = '.'.join(addr.split('.')[::-1]) + '.in-addr.arpa'
d = client.lookupPointer(ptr)
d.addCallback(lambda ans, auth, add: log.write(ans[0].payload.name))

	Is this approach stupid? :) Any suggestions as to the cleanest approach
to this are greatly appreciated!


More information about the Twisted-Python mailing list