[[PageOutline(1,Contents)]] = Twisted Names = Twisted Names is both a domain name server as well as a client resolver library. Twisted Names comes with an "out of the box" nameserver which can read most BIND-syntax zone files as well as a simple Python-based configuration format. Twisted Names can act as an authoritative server, perform zone transfers from a master to act as a secondary, act as a caching nameserver, or any combination of these. Twisted Names' client resolver library provides functions to query for all commonly used record types as well as a replacement for the blocking gethostbyname() function provided by the Python stdlib socket module. = Examples = Running a caching DNS server is as easy as running `twistd`. See `twistd dns --help` for more details {{{ $ twistd -n dns --port 5354 --recursive --cache }}} This is how you can do some name resolution with Twisted Names. {{{ #!py $ python -m twisted.conch.stdio >>> from twisted.names import client >>> client.getHostByName('twistedmatrix.com') >>> client.lookupMailExchange('twistedmatrix.com') ], [], [])> }}} Twisted has pluggable resolvers, the default resolver reads ''/etc/resolv.conf'' (Or ''C:\windows\system\hosts.txt'' on windows), /etc/hosts and has a cache. You can create an alternate resolver to resolve names. Such as in the following example. {{{ #!py $ python -m twisted.conch.stdio >>> from twisted.names import client >>> resolver = client.createResolver(servers=['8.8.8.8', '8.8.4.4'], hosts='alternate_hosts_file') >>> resolver.getHostByName('twistedmatrix.com') }}} You can affect all future name resolution in the reactor and from the `twisted.names.client` by installing a custom resolver into the reactor. {{{ #!py from twisted.internet import reactor from twisted.names import client reactor.installResolver(client.createResolver(servers=['8.8.8.8', '8.8.4.4'], hosts='alternate_hosts_file')) }}} = Download = See the [wiki:Downloads] page. = Documentation = [http://twistedmatrix.com/projects/names/documentation/ Documentation] is available for Twisted Names. An [http://twistedmatrix.com/documents/current/api/ API reference] of Twisted and all subprojects is also available. = Contact = Subscribe to the [http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python twisted-python] mailing list or visit the #twisted channel on irc.freenode.net to ask questions. [http://twistedmatrix.com/trac/newticket?type=defect&component=names Report a bug] or [http://twistedmatrix.com/trac/newticket?type=enhancement&component=names request a feature] using the issue tracker (registration required), or browse [query:status=new|assigned|reopened&component=names Twisted Names tickets].