[Twisted-Python] Writing a simple nameserver
exarkun at divmod.com
Wed Aug 9 10:39:43 EDT 2006
On Wed, 9 Aug 2006 16:24:59 +0200, Yves Glodt <y.glodt at sitasoftware.lu> wrote:
>I have a database which contains a list of hosts with their IP-addresses, and
>I need to be able to connect to them by their name.
>The plan is to write a simple daemon using twisted names which accepts the dns
>query, looks up the requested address in the database, and answers the dns
>How would I do that with twisted names?
>(I skimmed over the documentation but got blinded by "Undocumented" labels.)
You want to implement an authority. There is basically no documentation
for this, as you discovered. You can take a look at one of the existing
authority implementations for some hints:
Once you have an authority, you just need to construct a server based on
it. You can see an example of this in the tap module:
This basically amounts to passing a list of authorities to a protocol
instance and then using listenUDP with it.
Twisted Names has never really received any polish. The API it presents
for doing this is not necessarily well thought out or completely consistent.
If you would like to improve it, please feel free.
More information about the Twisted-Python