File: //usr/lib/python3/dist-packages/twisted/names/__pycache__/server.cpython-310.pyc
o
�b�V � @ sJ d Z ddlZddlmZ ddlmZmZ ddlmZ G dd� dej �Z
dS )a`
Async DNS server
Future plans:
- Better config file format maybe
- Make sure to differentiate between different classes
- notice truncation bit
Important: No additional processing is done on some of the record types.
This violates the most basic RFC and is just plain annoying
for resolvers to deal with. Fix it.
@author: Jp Calderone
� N)�protocol)�dns�resolve)�logc @ s� e Zd ZdZejZdZejZ d$dd�Z
dd� Zdd � Zd
d� Z
dd
� Zdd� Zejdddfdd�Zdd� Zdd� Zdd� Zdd� Zdd� Zdd� Zdd� Zd%d d!�Zd"d#� ZdS )&�DNSServerFactorya
Server factory and tracker for L{DNSProtocol} connections. This class also
provides records for responses to DNS queries.
@ivar cache: A L{Cache<twisted.names.cache.CacheResolver>} instance whose
C{cacheResult} method is called when a response is received from one of
C{clients}. Defaults to L{None} if no caches are specified. See
C{caches} of L{__init__} for more details.
@type cache: L{Cache<twisted.names.cache.CacheResolver>} or L{None}
@ivar canRecurse: A flag indicating whether this server is capable of
performing recursive DNS resolution.
@type canRecurse: L{bool}
@ivar resolver: A L{resolve.ResolverChain} containing an ordered list of
C{authorities}, C{caches} and C{clients} to which queries will be
dispatched.
@type resolver: L{resolve.ResolverChain}
@ivar verbose: See L{__init__}
@ivar connections: A list of all the connected L{DNSProtocol} instances
using this object as their controller.
@type connections: C{list} of L{DNSProtocol} instances
@ivar protocol: A callable used for building a DNS stream protocol. Called
by L{DNSServerFactory.buildProtocol} and passed the L{DNSServerFactory}
instance as the one and only positional argument. Defaults to
L{dns.DNSProtocol}.
@type protocol: L{IProtocolFactory} constructor
@ivar _messageFactory: A response message constructor with an initializer
signature matching L{dns.Message.__init__}.
@type _messageFactory: C{callable}
Nr c C sn g }|dur|� |� |dur|� |� |dur|� |� | | _t�|�| _|| _|r2|d | _g | _dS )a�
@param authorities: Resolvers which provide authoritative answers.
@type authorities: L{list} of L{IResolver} providers
@param caches: Resolvers which provide cached non-authoritative
answers. The first cache instance is assigned to
C{DNSServerFactory.cache} and its C{cacheResult} method will be
called when a response is received from one of C{clients}.
@type caches: L{list} of L{Cache<twisted.names.cache.CacheResolver>} instances
@param clients: Resolvers which are capable of performing recursive DNS
lookups.
@type clients: L{list} of L{IResolver} providers
@param verbose: An integer controlling the verbosity of logging of
queries and responses. Default is C{0} which means no logging. Set
to C{2} to enable logging of full query and response messages.
@type verbose: L{int}
N���)�extend�
canRecurser �
ResolverChain�resolver�verbose�cache�connections)�self�authorities�caches�clientsr � resolvers� r �6/usr/lib/python3/dist-packages/twisted/names/server.py�__init__E s
zDNSServerFactory.__init__c O s"