관리-도구
편집 파일: zone.cpython-36.opt-1.pyc
3 ӕ�WZ� � @ sN d Z ddlmZ ddlZddlZddlZddlmZ ddlZ ddl Z ddlZ ddlZ ddl Z ddlZ ddlZ ddlZ ddlZ ddlZ ddlmZmZ ejdkZG dd � d e jj�ZG d d� de�ZG dd � d e�ZG dd� de�ZG dd� de�ZG dd� de�Z de j!j"dedddfdd�Z#de j!j"dedddfdd�Z$eddfdd�Z%dS )z DNS Zones.� )� generatorsN)�BytesIO� )�string_types� text_type� c @ s e Zd ZdZdS )�BadZonezThe DNS zone is malformed.N)�__name__� __module__�__qualname__�__doc__� r r �/usr/lib/python3.6/zone.pyr ) s r c @ s e Zd ZdZdS )�NoSOAz)The DNS zone has no SOA RR at its origin.N)r r r r r r r r r . s r c @ s e Zd ZdZdS )�NoNSz+The DNS zone has no NS RRset at its origin.N)r r r r r r r r r 3 s r c @ s e Zd ZdZdS )� UnknownOriginz!The DNS zone's origin is unknown.N)r r r r r r r r r 8 s r c @ sj e Zd ZdZejjZddddgZej j dfdd�Zd d � Zdd� Z d d� Zdd� Zdd� Zdd� Zdd� Zdd� Zdd� Zdd� Zdd� Zdd � ZeZd!d"� Zd#d$� ZdCd&d'�ZdDd(d)�Zd*d+� Zejjd%fd,d-�Z ejjd%fd.d/�Z!ejjfd0d1�Z"d2d3� Z#ejjfd4d5�Z$ejjfd6d7�Z%ejj&ejjfd8d9�Z'ejj&ejjfd:d;�Z(dEd=d>�Z)dFd?d@�Z*dAdB� Z+d<S )G�ZoneaZ A DNS zone. A Zone is a mapping from names to nodes. The zone object may be treated like a Python dictionary, e.g. zone[name] will retrieve the node associated with that name. The I{name} may be a dns.name.Name object, or it may be a string. In the either case, if the name is relative it is treated as relative to the origin of the zone. @ivar rdclass: The zone's rdata class; the default is class IN. @type rdclass: int @ivar origin: The origin of the zone. @type origin: dns.name.Name object @ivar nodes: A dictionary mapping the names of nodes in the zone to the nodes themselves. @type nodes: dict @ivar relativize: should names in the zone be relativized? @type relativize: bool @cvar node_factory: the factory used to create a new node @type node_factory: class or callable �rdclass�origin�nodes� relativizeTc C sb |dk rFt |t�r tjj|�}nt |tjj�s6td��|j� sFtd��|| _|| _ i | _ || _dS )z�Initialize a zone object. @param origin: The origin of the zone. @type origin: dns.name.Name object @param rdclass: The zone's rdata class; the default is class IN. @type rdclass: intNz2origin parameter must be convertible to a DNS namez)origin parameter must be an absolute name)� isinstancer �dns�name� from_text�Name� ValueError�is_absoluter r r r )�selfr r r r r r �__init__Y s z Zone.__init__c C s: t |t�sdS | j|jks2| j|jks2| j|jkr6dS dS )ziTwo zones are equal if they have the same origin, class, and nodes. @rtype: bool FT)r r r r r )r �otherr r r �__eq__n s zZone.__eq__c C s | j |� S )z6Are two zones not equal? @rtype: bool )r! )r r r r r �__ne__| s zZone.__ne__c C sb t |t�rtjj|d �}nt |tjj�s0td��|j� r^|j| j �sLtd��| j r^|j | j �}|S )Nz0name parameter must be convertible to a DNS namez5name parameter must be a subdomain of the zone origin)r r r r r r �KeyErrorr �is_subdomainr r )r r r r r �_validate_name� s zZone._validate_namec C s | j |�}| j| S )N)r% r )r �keyr r r �__getitem__� s zZone.__getitem__c C s | j |�}|| j|<