+\hB UdZddlZddlZddlZddlZddlmZmZmZm Z ddl Z ddl Z ddl Z ddlZ Gdde jj ZGddZGdd eZGd d eZGd d e jj ZGddeZGddeZGddeZGddeZej4eej6eej8eej:eej<eiZeeefe d<dedefdZ!de ee"fdddefdZ#de ee"fde$de%de%def d Z&d!ededdfd"Z'ej8ZejPZ(ejRZ)ejTZ*ej4ZejVZ+ej:ZejXZ,ejZZ-ej\Z.ej6Zej<Zy)#z EDNS OptionsN)AnyDictOptionalUnioncLeZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z d Zed Zy) OptionType cyNiclss K/root/niggaflix-v3/playground/venv/lib/python3.12/site-packages/dns/edns.py_maximumzOptionType._maximum:N)__name__ __module__ __qualname__NSIDDAUDHUN3UECSEXPIRECOOKIE KEEPALIVEPADDINGCHAINEDE REPORTCHANNEL classmethodrrrrrr sP D C C C C F FIG E CMrrceZdZdZdeeeffdZddee dee fdZ defdZ e ded d ddfd Zd Zd ZdZdZdZdZdZdZy)Optionz%Base class for all EDNS option types.otypec8tj||_y)z_Initialize an option. *otype*, a ``dns.edns.OptionType``, is the option type. N)rmaker0)selfr0s r__init__zOption.__init__Bs  __U+ rNfilereturnct)zUConvert an option to wire format. Returns a ``bytes`` or ``None``. NotImplementedErrorr3r5s rto_wirezOption.to_wireIs "!rctNr8r3s rto_textzOption.to_textQs!!rparserdns.wire.Parserct)aBuild an EDNS option object from wire format. *otype*, a ``dns.edns.OptionType``, is the option type. *parser*, a ``dns.wire.Parser``, the parser, which should be restructed to the option length. Returns a ``dns.edns.Option``. r8rr0r@s rfrom_wire_parserzOption.from_wire_parserTs "!rc\|j}|j}||k(ry||kDryy)zCompare an EDNS option with another option of the same type. Returns < 0 if < *other*, 0 if == *other*, and > 0 if > *other*. r)r;)r3otherwireowires r_cmpz Option._cmpas1 ||~  5= %<rct|tsy|j|jk7ry|j|dk(S)NFr isinstancer/r0rKr3rHs r__eq__z Option.__eq__ns6%( :: $yy1$$rct|tsy|j|jk7ry|j|dk7S)NTrrMrOs r__ne__z Option.__ne__us6%( :: $yy1$$rct|tr|j|jk7rtS|j |dkSNrrNr/r0NotImplementedrKrOs r__lt__z Option.__lt__|5%(DJJ%++,E! !yy!##rct|tr|j|jk7rtS|j |dkSrTrUrOs r__le__z Option.__le__5%(DJJ%++,E! !yy1$$rct|tr|j|jk7rtS|j |dk\SrTrUrOs r__ge__z Option.__ge__r[rct|tr|j|jk7rtS|j |dkDSrTrUrOs r__gt__z Option.__gt__rXrc"|jSr=)r?r>s r__str__zOption.__str__s||~rr=)rrr __doc__rrstrr4rrbytesr;r?r-rDrKrPrRrWrZr]r_rarrrr/r/?s/,eJO4,"HSM"Xe_""" "Z "9J "x " " %%$ % % $ rr/ceZdZdZdeeefdeeefffd Zd de e de efdZ defdZ e deeefd d defd ZxZS) GenericOptionzwGeneric Option Class This class is used for EDNS option types for which we have no better implementation. r0datact||tjjj |d|_y)NT)superr4dnsrdataRdata _as_bytesrg)r3r0rg __class__s rr4zGenericOption.__init__s, IIOO--dD9 rr5r6cV|r|j|jy|jSr=)writergr:s rr;zGenericOption.to_wire"  JJtyy !99 rc d|jzS)Nz Generic %d)r0r>s rr?zGenericOption.to_textsdjj((rr@rAc0|||jSr= get_remainingrCs rrDzGenericOption.from_wire_parsers5&..011rr=)rrr rbrrrcrdr4rrr;r?r-r/rD __classcell__rns@rrfrfs :eJO4:E%*> !DK~iioo66w?GYY__,,VQ;Fyy..xB?H12 2!!!    88%%b'2TYYv|,-!&)   A:;;sC bc(:$;tE ?R$STD MM#2.5DM rr6cTd|jd|jd|jS)NzECS /z scope/)rzr{r|r>s rr?zECSOption.to_texts'dll^1T[[MHHrtextc:d}|j}d}t|dk(r|d}n:t|dk(r|d|k7rtd|d|d}ntd|d|jd}|dk(r|jd\}}d }n*|dk(r|jd\}}}ntd|d t |} t |} t || |S#t$rtd d|d zwxYw#t$rtd d|d zwxYw)aConvert a string into a `dns.edns.ECSOption` *text*, a `str`, the text form of the option. Returns a `dns.edns.ECSOption`. Examples: >>> import dns.edns >>> >>> # basic example >>> dns.edns.ECSOption.from_text('1.2.3.4/24') >>> >>> # also understands scope >>> dns.edns.ECSOption.from_text('1.2.3.4/24/32') >>> >>> # IPv6 >>> dns.edns.ECSOption.from_text('2001:4b98::1/64/64') >>> >>> # it understands results from `dns.edns.ECSOption.to_text()` >>> dns.edns.ECSOption.from_text('ECS 1.2.3.4/24/32') r%NrFrr~zcould not parse ECS from ""r0zinvalid scope z": scope must be an integerzinvalid srclen z": srclen must be an integer)splitlenrcountrry) roptional_prefixtokensecs_text n_slashesrztsrclentscopescoper{s r from_textzECSOption.from_textsb0  v;! ayH [A ayO+ #=dV1!EFFayH9$qAB BNN3' >'~~c2 GWF !^'/~~c': $GWf9$qAB B YKE \F &%00 Y-!F8;V0WWX X Y !ay0L$MM  s; C C>C;>Dr5ctjd|j|j|j|j z}|r|j |y|S)N!HBB)rrrr{r|rrpr3r5values rr;zECSOption.to_wiresG KK T[[$-- H4== X   JJu Lrr0r@rAcz|jd\}}}ttj|dz }|j |}|dk(r+d|z }t j j|d|zz} n;|dk(r+d|z }t jj|d|zz} n td|| ||S) NrrrFr~zunsupported family) get_structrrr get_bytesrjipv4 inet_ntoaipv6r) rr0r@rsrcraddrlenprefixpadaddrs rrDzECSOption.from_wire_parser&s$..v6Udiic *+!!'* Q;g+C88%%fw}&<=D q[w,C88%%fw}&<=D12 24e$$rrTr=)rrr rbrcrrr4r? staticmethodr/rrrdr;r-rrrDrvrws@rryrys+-6-6Xc]-6S-6^II41414141lHSMXe_%*c/*%4E% %%rryceZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z d Zd ZdZdZdZdZdZdZdZdZdZdZdZdZedZy)EDECoderrFr~r rr r r r rrrrrrrrrcyrrrs rrzEDECode._maximumTrrN)rrr OTHERUNSUPPORTED_DNSKEY_ALGORITHMUNSUPPORTED_DS_DIGEST_TYPE STALE_ANSWER FORGED_ANSWERDNSSEC_INDETERMINATE DNSSEC_BOGUSSIGNATURE_EXPIREDSIGNATURE_NOT_YET_VALIDDNSKEY_MISSINGRRSIGS_MISSINGNO_ZONE_KEY_BIT_SET NSEC_MISSING CACHED_ERROR NOT_READYBLOCKEDCENSOREDFILTERED PROHIBITEDSTALE_NXDOMAIN_ANSWERNOT_AUTHORITATIVE NOT_SUPPORTEDNO_REACHABLE_AUTHORITY NETWORK_ERROR INVALID_DATAr-rrrrrr9s E#$ !"LMLNNLLIGHHJMMLrrceZdZdZhdZddeeefdeeffd Z defdZ ddee dee fd Z ed eeefd d defd ZxZS) EDEOptionz!Extended DNS Error (EDE, RFC8914)>DSNSECDNSKEYDNSSECRRSIGsNXDOMAINcoderct|tjtj ||_|t|ts td||_ y)z*code*, a ``dns.edns.EDECode`` or ``str``, the info code of the extended error. *text*, a ``str`` or ``None``, specifying additional information about the error. Nztext must be string or None) rir4rr+rr2rrNrcrr)r3rrrns rr4zEDEOption.__init__^sH (LL&  JtS$9:; ; rr6c(dj}jtvrQtjj}djfd|j dD}|d|dz }j |dj z }|S)NzEDE  c3^K|]$}|jvr|n|j&ywr=)_preserve_casetitle).0wordr3s r z$EDEOption.to_text..qs1 3 33Es*-_z ()z: )rrr?joinrr)r3outputdescs` rr?zEDEOption.to_textms {# 99 ??499-D88 JJsOD 4&l "F 99 499+& &F rr5ctjd|j}|j||jj dz }|r|j |y|S)Nz!Hutf8)rrrrencoderprs rr;zEDEOption.to_wirezsP D$)), 99 TYY%%f- -E  JJu Lrr0r@rActj|j}|j}|r|ddk(r|dd}|j d}nd}|||S)NrGrr)rr2 get_uint16rudecode)rr0r@rrbtexts rrDzEDEOption.from_wire_parsersb||F--/0##% Bx1}CRyKK'EE4rr=)rrr rbrrrrcrr4r?rrdr;r-rr/rDrvrws@rrrYs+MN U7C<0     HSM Xe_   *c/*  4E      rrceZdZdeffd Zd dedeefdZdefdZ e de e efde jjdefd ZxZS) NSIDOptionnsidcNt|tj||_yr=)rir4rr!r)r3rrns rr4zNSIDOption.__init__s ) rr5r6cV|r|j|jy|jSr=)rprr:s rr;zNSIDOption.to_wirerqrctd|jDr|jj}n-tj|jj}d|S)Nc34K|]}|dk\xr|dkyw)r~Nr)rcs rrz%NSIDOption.to_text..s :1qDy&Q$Y&:szNSID )allrrbinasciihexlify)r3rs rr?zNSIDOption.to_textsO : : :II$$&E$$TYY/668Eugrr0r@c.||jSr=rtrCs rrDzNSIDOption.from_wire_parsers6'')**rr=rrr rdr4rrr;rcr?r-rrrjrIParserr/rDrvrws@rrrsoUC8E?+*c/*+47HHOO+ ++rrceZdZdedeffd Zd dedeefdZdefdZ e de e efd e jjdefd ZxZS) CookieOptionclientserverc"t|tjjj ||_||_t|dk7r tdt|dk7r(t|dkst|dkDr tdyy)Nr zclient cookie must be 8 bytesrrz5server cookie must be empty or between 8 and 32 bytes) rir4rjednsrr'rrrr)r3rrrns rr4zCookieOption.__init__s| ,,334  v;! <= = v;! VqCK"4DTU U5E rr5r6c|rO|j|jt|jdkDr|j|jy|j|jzSrT)rprrrr:s rr;zCookieOption.to_wiresL  JJt{{ #4;;!# 4;;';;, ,rctj|jj}t |j dkDr.tj|j j}nd}d||S)NrzCOOKIE )r r rrrr)r3rrs rr?zCookieOption.to_textsc!!$++.557 t{{ a %%dkk299;FF))rr0r@cN||jd|jS)Nr )rrurCs rrDzCookieOption.from_wire_parsers%6##A&(<(<(>??rr=rrws@rrrs~VuVeV-C-8E?-**@*c/*@47HHOO@ @@rrceZdZdejj ffd Zd dedee fdZ de fdZ e deee fdej j"defd ZxZS) ReportChannelOption agent_domaincNt|tj||_yr=)rir4rr,r)r3rrns rr4zReportChannelOption.__init__s 112(rr5r6c8|jj|Sr=)rr;r:s rr;zReportChannelOption.to_wires  ((..rc<d|jjzS)NzREPORTCHANNEL )rr?r>s rr?zReportChannelOption.to_texts$"3"3";";"===rr0r@c.||jSr=)get_namerCs rrDz$ReportChannelOption.from_wire_parsers6??$%%rr=)rrr rjnameNamer4rrrdr;rcr?r-rrrIrr/rDrvrws@rrrsw)SXX]])/C/8E?/>>&*c/*&47HHOO& &&rr_type_to_classr0r6c@tj|}|t}|S)zReturn the class for the specified option type. The GenericOption class is used if a more specific class is not known. )r$getrf)r0rs rget_option_classr's#   U #C { Jrr@rAcftj|}t|}|j||S)aBuild an EDNS option object from wire format. *otype*, an ``int``, is the option type. *parser*, a ``dns.wire.Parser``, the parser, which should be restricted to the option length. Returns an instance of a subclass of ``dns.edns.Option``. )rr2r'rD)r0r@rs roption_from_wire_parserr)s/ OOE "E 5 !C   v ..rrIcurrentolenctjj||}|j|5t ||cdddS#1swYyxYw)arBuild an EDNS option object from wire format. *otype*, an ``int``, is the option type. *wire*, a ``bytes``, is the wire-format message. *current*, an ``int``, is the offset in *wire* of the beginning of the rdata. *olen*, an ``int``, is the length of the wire-format option data Returns an instance of a subclass of ``dns.edns.Option``. N)rjrIr restrict_tor))r0rIr*r+r@s roption_from_wirer. sE XX__T7 +F   D !6&uf5666s AAimplementationc|t|<y)zRegister the implementation of an option type. *implementation*, a ``class``, is a subclass of ``dns.edns.Option``. *otype*, an ``int``, is the option type. N)r$)r/r0s r register_typer1"s+N5r)/rbr rrrtypingrrrrdns.enumrjdns.inet dns.rdatadns.wireenumIntEnumrr/rfryrrrrrr%r+r!r'r,r$__annotations__r'rcr)rdrr.r1r"r#r$r&r(r)r*rrrr:s$ --!!>RRj2F28F%F%Rchh@: : z++6@6@D&&&(NNINNIOOZ|1 )Z_% J 3 / S !/+</ /"6 S !6).69<6DG6 6*+#+j+T+nnnnnnnn          nn(( r