Files
pyGoEdge-UserPanel/.venv/Lib/site-packages/dns/__pycache__/renderer.cpython-312.pyc

134 lines
16 KiB
Plaintext
Raw Normal View History

2025-11-18 03:36:49 +08:00
<EFBFBD>
g<> i<>,<00><00><><00>dZddlZddlZddlZddlZddlZddlZddlZddl Zddl
Zddl ZdZ dZ dZdZej d<06><00>ZGd<07>d<08>Zy) z*Help for building DNS wire format messages<65>N<><00><00>c#<00><>K<00>|jd|z<00>|j<00>}d<00><01>|j<00>}||z
}|dkDrJ |j||z
<00> |j|j|d<03><00> |j|<03>yy#t$rt
j j<00>wxYw#|j|<03>wxYw<01>w)N<>r<00>big)<08>write<74>tell<6C>seek<65>to_bytes<65> OverflowError<6F>dns<6E> exception<6F> FormError)<05>output<75> length_length<74>start<72>end<6E>lengths <20>;E:\Project\pygoedge\.venv\Lib\site-packages\dns/renderer.py<70>prefixed_lengthr(s<><00><00><><00>
<EFBFBD>L<EFBFBD>L<EFBFBD><16>-<2D>'<27>(<28> <12>K<EFBFBD>K<EFBFBD>M<EFBFBD>E<EFBFBD> <09>
<10>+<2B>+<2B>-<2D>C<EFBFBD> <10>5<EFBFBD>[<5B>F<EFBFBD> <0A><01>z<EFBFBD> <1D> <12>K<EFBFBD>K<EFBFBD><05> <0A>-<2D> .<2E> .<2E><16> <0C> <0C>V<EFBFBD>_<EFBFBD>_<EFBFBD>]<5D>E<EFBFBD>B<>C<> <13>K<EFBFBD>K<EFBFBD><03> <1C><12><>
!<21> .<2E><19>m<EFBFBD>m<EFBFBD>-<2D>-<2D>-<2D> .<2E><> <13>K<EFBFBD>K<EFBFBD><03> <1C>s0<00>AC <01>B7<00>!B<00>=C <01>$B4<03>4B7<00>7C
<03>
C c<00>H<00>eZdZdZdd<03>Zd<04>Zd<05>Zejd<06><00>Z ejd<07><00>Z
e jjfd<08>Zd <09>Zd
<EFBFBD>Zdd <0B>Zdd <0C>Ze j&j(fd <0A>Ze j&j(fd<0E>Zd<0F>Zd<10>Zd<11>Zdeddfd<14>Zdd<15>Zy)<1A>Renderera<72>Helper class for building DNS wire-format messages.
Most applications can use the higher-level L{dns.message.Message}
class and its to_wire() method to generate wire-format messages.
This class is for those applications which need finer control
over the generation of messages.
Typical use::
r = dns.renderer.Renderer(id=1, flags=0x80, max_size=512)
r.add_question(qname, qtype, qclass)
r.add_rrset(dns.renderer.ANSWER, rrset_1)
r.add_rrset(dns.renderer.ANSWER, rrset_2)
r.add_rrset(dns.renderer.AUTHORITY, ns_rrset)
r.add_rrset(dns.renderer.ADDITIONAL, ad_rrset_1)
r.add_rrset(dns.renderer.ADDITIONAL, ad_rrset_2)
r.add_edns(0, 0, 4096)
r.write_header()
r.add_tsig(keyname, secret, 300, 1, 0, '', request_mac)
wire = r.get_wire()
If padding is going to be used, then the OPT record MUST be
written after everything else in the additional section except for
the TSIG (if any).
output, an io.BytesIO, where rendering is written
id: the message id
flags: the message flags
max_size: the maximum size of the message
origin: the origin to use when rendering relative names
compress: the compression table
section: an int, the section currently being rendered
counts: list of the number of RRs in each section
mac: the MAC of the rendered message (if TSIG was used)
Nc<00>@<00>tj<00>|_|<01>tjdd<03>|_n||_||_||_||_i|_ t|_ gd<04>|_ |jjd<05>d|_d|_d|_y)zInitialize a new renderer.Nr<00><><EFBFBD>)rrrrs <00>F)<11>io<69>BytesIOr<00>random<6F>randint<6E>id<69>flags<67>max_size<7A>origin<69>compress<73>QUESTION<4F>section<6F>countsr <00>mac<61>reserved<65>
was_padded)<05>selfr!r"r#r$s r<00>__init__zRenderer.__init__gs<><00><00><19>j<EFBFBD>j<EFBFBD>l<EFBFBD><04> <0B> <0A>:<3A><1C>n<EFBFBD>n<EFBFBD>Q<EFBFBD><05>.<2E>D<EFBFBD>G<EFBFBD><18>D<EFBFBD>G<EFBFBD><1A><04>
<EFBFBD> <20><04> <0A><1C><04> <0B><1A><04> <0A><1F><04> <0C>"<22><04> <0B> <0C> <0B> <0B><19><19>,<2C>'<27><15><04><08><19><04> <0A><1F><04><0F>c<00> <00>|jj|<01>|jj<00>g}|jj <00>D]\}}||k\s<01> |j |<03><00>|D]}|j|=<00>y)z<>Truncate the output buffer at offset *where*, and remove any
compression table entries that pointed beyond the truncation
point.
N)rr <00>truncater%<00>items<6D>append)r,<00>where<72>keys_to_delete<74>k<>vs r<00> _rollbackzRenderer._rollbackzss<00><00> <0A> <0B> <0B><18><18><15><1F> <0C> <0B> <0B><1C><1C><1E><1B><0E><18>M<EFBFBD>M<EFBFBD>'<27>'<27>)<29>D<EFBFBD>A<EFBFBD>q<EFBFBD><10>E<EFBFBD>z<EFBFBD><1E>%<25>%<25>a<EFBFBD>(<28>*<2A> <20>A<EFBFBD><14> <0A> <0A>a<EFBFBD> <20> r.c<00><><00>|j|k7r1|j|kDrtjj<00>||_yy)aSet the renderer's current section.
Sections must be rendered order: QUESTION, ANSWER, AUTHORITY,
ADDITIONAL. Sections may be empty.
Raises dns.exception.FormError if an attempt was made to set
a section value less than the current section.
N)r'rrr)r,r's r<00> _set_sectionzRenderer._set_section<6F>s8<00><00> <10><<3C><<3C>7<EFBFBD> "<22><13>|<7C>|<7C>g<EFBFBD>%<25><19>m<EFBFBD>m<EFBFBD>-<2D>-<2D>-<2D>"<22>D<EFBFBD>L<EFBFBD> #r.c#<00><>K<00>|jj<00>}|<01><01>|jj<00>|jkDr+|j|<01>tj
j <00>y<00>w<01>N)rr
r#r7rr<00>TooBig)r,rs r<00> _track_sizezRenderer._track_size<7A>sW<00><00><><00><14> <0B> <0B> <20> <20>"<22><05><13> <0B> <0F>;<3B>;<3B> <1B> <1B> <1D><04> <0A> <0A> -<2D> <10>N<EFBFBD>N<EFBFBD>5<EFBFBD> !<21><15>-<2D>-<2D>&<26>&<26> &<26> .<2E>s<00>A2A4c#<00><>K<00>|jj<00>} |jj|<01>d<00><02>|jj|<02>y#|jj|<02>wxYw<01>wr;)rr
r )r,r3<00>currents r<00>_temporarily_seek_tozRenderer._temporarily_seek_to<74>sV<00><00><><00><16>+<2B>+<2B>"<22>"<22>$<24><07> &<26> <10>K<EFBFBD>K<EFBFBD> <1C> <1C>U<EFBFBD> #<23> <11> <10>K<EFBFBD>K<EFBFBD> <1C> <1C>W<EFBFBD> %<25><>D<EFBFBD>K<EFBFBD>K<EFBFBD> <1C> <1C>W<EFBFBD> %<25>s<00>A9<01>A<00>A9<01>A6<03>6A9c<00>p<00>|jt<00>|j<00>5|j|j|j
|j <00>|jjtjd||<03><00>ddd<02>|jtxxdz cc<y#1swY<00>%xYw)zAdd a question to the message.z!HHNr) r9r&r=<00>to_wirerr%r$r <00>struct<63>packr()r,<00>qname<6D>rdtype<70>rdclasss r<00> add_questionzRenderer.add_question<6F>s}<00><00> <0A><19><19>(<28>#<23> <11> <1D> <1D> <1F> <11>M<EFBFBD>M<EFBFBD>$<24>+<2B>+<2B>t<EFBFBD>}<7D>}<7D>d<EFBFBD>k<EFBFBD>k<EFBFBD> B<> <10>K<EFBFBD>K<EFBFBD> <1D> <1D>f<EFBFBD>k<EFBFBD>k<EFBFBD>%<25><16><17>A<> B<> <20> <0A> <0B> <0B>H<EFBFBD><1D><11>"<22><1D> <20> <1F>s <00>A"B,<03>,B5c <00><00>|j|<01>|j<00>5|j|j|j|j
fi|<03><01>}ddd<01>|j |xxz cc<y#1swY<00>!xYw)z<>Add the rrset to the specified section.
Any keyword arguments are passed on to the rdataset's to_wire()
routine.
N<>r9r=rBrr%r$r()r,r'<00>rrset<65>kw<6B>ns r<00> add_rrsetzRenderer.add_rrset<65>se<00><00> <0A><19><19>'<27>"<22> <11> <1D> <1D> <1F><1D><05> <0A> <0A>d<EFBFBD>k<EFBFBD>k<EFBFBD>4<EFBFBD>=<3D>=<3D>$<24>+<2B>+<2B>L<><12>L<>A<EFBFBD> <20> <0C> <0B> <0B>G<EFBFBD><1C><01>!<21><1C> <20> <1F>s <00>4A6<03>6A?c <00><00>|j|<01>|j<00>5|j||j|j|j
fi|<04><01>}ddd<01>|j |xxz cc<y#1swY<00>!xYw)z<>Add the rdataset to the specified section, using the specified
name as the owner name.
Any keyword arguments are passed on to the rdataset's to_wire()
routine.
NrJ)r,r'<00>name<6D>rdatasetrLrMs r<00> add_rdatasetzRenderer.add_rdataset<65>sj<00><00> <0A><19><19>'<27>"<22> <11> <1D> <1D> <1F> <20><08> <20> <20><14>t<EFBFBD>{<7B>{<7B>D<EFBFBD>M<EFBFBD>M<EFBFBD>4<EFBFBD>;<3B>;<3B>U<>RT<52>U<>A<EFBFBD> <20> <0C> <0B> <0B>G<EFBFBD><1C><01>!<21><1C> <20> <1F>s <00>5A7<03>7Bc<00> <00>|r<>|j}|dk\sJ<00>|d}|jj<00>|z|z}||z}|r d||z
z}nd}t|j<00>} | j t jjt jjj|<02><00>t jjj||j| <09>}d|_|j!t"|<01>y)aMAdd *opt* to the additional section, applying padding if desired. The
padding will take the specified precomputed OPT size and TSIG size into
account.
Note that we don't have reliable way of knowing how big a GSS-TSIG digest
might be, so we we might not get an even multiple of the pad in that case.<2E> rrr.TN)<12>ttlrr
<00>list<73>optionsr2r<00>edns<6E> GenericOption<6F>
OptionType<EFBFBD>PADDING<4E>message<67>Message<67> _make_optrGr+rN<00>
ADDITIONAL)
r,<00>opt<70>pad<61>opt_size<7A> tsig_sizerU<00> opt_rdata<74>size_without_padding<6E> remainderrWs
r<00>add_optzRenderer.add_opt<70>s<><00><00> <0F><15>'<27>'<27>C<EFBFBD><1B>r<EFBFBD>><3E> !<21>><3E><1B>A<EFBFBD><06>I<EFBFBD>#'<27>;<3B>;<3B>#3<>#3<>#5<><08>#@<40>9<EFBFBD>#L<> <20>,<2C>s<EFBFBD>2<>I<EFBFBD><18><1D><13>y<EFBFBD><1F>1<><03><19><03><1A>9<EFBFBD>,<2C>,<2C>-<2D>G<EFBFBD> <13>N<EFBFBD>N<EFBFBD>3<EFBFBD>8<EFBFBD>8<EFBFBD>1<>1<>#<23>(<28>(<28>2E<32>2E<32>2M<32>2M<32>s<EFBFBD>S<> T<><15>+<2B>+<2B>%<25>%<25>/<2F>/<2F><13>Y<EFBFBD>&<26>&<26><07><0E>C<EFBFBD>#<23>D<EFBFBD>O<EFBFBD> <0C><0E><0E>z<EFBFBD>3<EFBFBD>'r.c<00><><00>|dz}||dzz}tjjj|||<04>}|j |<05>y)z&Add an EDNS OPT record to the message.l<00>~<00>N)rr\r]r^rg)r,rX<00> ednsflags<67>payloadrWr`s r<00>add_ednszRenderer.add_edns<6E>sK<00><00> <12>Z<EFBFBD><1F> <09><11>T<EFBFBD>R<EFBFBD>Z<EFBFBD><1F> <09><11>k<EFBFBD>k<EFBFBD>!<21>!<21>+<2B>+<2B> <15>w<EFBFBD><07>
<EFBFBD><03> <0A> <0C> <0C>S<EFBFBD>r.c
<00><><00>|jj<00>} t|tjj
<00>r|}
n!tjj |||<08>}
tj jj||d|d|||<06>} tjj| |
| dttj<00><00>|<07>\} } |j| |<01>y)z$Add a TSIG signature to the message.rr.N<> r<00>getvalue<75>
isinstancer<00>tsig<69>Keyr\r]<00>
_make_tsig<EFBFBD>sign<67>int<6E>time<6D> _write_tsig) r,<00>keyname<6D>secret<65>fudger!<00>
tsig_error<EFBFBD>
other_data<EFBFBD> request_mac<61> algorithm<68>s<>keyrq<00>_s r<00>add_tsigzRenderer.add_tsig<69>s<><00><00> <11>K<EFBFBD>K<EFBFBD> <20> <20> "<22><01> <15>f<EFBFBD>c<EFBFBD>h<EFBFBD>h<EFBFBD>l<EFBFBD>l<EFBFBD> +<2B><18>C<EFBFBD><15>(<28>(<28>,<2C>,<2C>w<EFBFBD><06> <09>:<3A>C<EFBFBD><12>{<7B>{<7B>"<22>"<22>-<2D>-<2D> <13>Y<EFBFBD><01>5<EFBFBD>#<23>r<EFBFBD>:<3A>z<EFBFBD>
<EFBFBD><04><18>H<EFBFBD>H<EFBFBD>M<EFBFBD>M<EFBFBD>!<21>S<EFBFBD>$<24>q<EFBFBD>'<27>3<EFBFBD>t<EFBFBD>y<EFBFBD>y<EFBFBD>{<7B>3C<33>[<5B>Q<> <09><14>q<EFBFBD> <0C><18><18><14>w<EFBFBD>'r.c
<00><><00>|jj<00>}
t|tjj
<00>r|} n!tjj ||| <09>} tj jj|| d|d|||<07>} tjj|
| | dttj<00><00>||d<03>\} }|j| |<02>|S)ayAdd a TSIG signature to the message. Unlike add_tsig(), this can be
used for a series of consecutive DNS envelopes, e.g. for a zone
transfer over TCP [RFC2845, 4.4].
For the first message in the sequence, give ctx=None. For each
subsequent message, give the ctx that was returned from the
add_multi_tsig() call for the previous message.rr.Trn) r,<00>ctxrxryrzr!r{r|r}r~rr<>rqs r<00>add_multi_tsigzRenderer.add_multi_tsigs<><00><00>( <11>K<EFBFBD>K<EFBFBD> <20> <20> "<22><01> <15>f<EFBFBD>c<EFBFBD>h<EFBFBD>h<EFBFBD>l<EFBFBD>l<EFBFBD> +<2B><18>C<EFBFBD><15>(<28>(<28>,<2C>,<2C>w<EFBFBD><06> <09>:<3A>C<EFBFBD><12>{<7B>{<7B>"<22>"<22>-<2D>-<2D> <13>Y<EFBFBD><01>5<EFBFBD>#<23>r<EFBFBD>:<3A>z<EFBFBD>
<EFBFBD><04><1A>h<EFBFBD>h<EFBFBD>m<EFBFBD>m<EFBFBD> <0A>s<EFBFBD>D<EFBFBD><11>G<EFBFBD>S<EFBFBD><14><19><19><1B>-<2D>{<7B>C<EFBFBD><14>
<EFBFBD> <0B><14>s<EFBFBD> <0A><18><18><14>w<EFBFBD>'<27><12>
r.c <00>L<00>|jrd}n |j}|jt<00>|j <00>5|j |j ||j<00>|j jtjdtjjtjjd<02><00>t!|j d<03>5|j |j <00>ddd<00>ddd<00>|j"txxdz cc<|j%d<05>5|j jtjd|j"t<00><00>ddd<00>y#1swY<00><>xYw#1swY<00><>xYw#1swYyxYw)Nz!HHIrrr<00>
z!H)r+r%r9r_r=rBrr$r rCrDr<00> rdatatype<70>TSIG<49>
rdataclass<EFBFBD>ANYrr(r@)r,rqrxr%s rrwzRenderer._write_tsig+s<00><00> <0F>?<3F>?<3F><1B>H<EFBFBD><1B>}<7D>}<7D>H<EFBFBD> <0C><19><19>*<2A>%<25> <11> <1D> <1D> <1F> <13>O<EFBFBD>O<EFBFBD>D<EFBFBD>K<EFBFBD>K<EFBFBD><18>4<EFBFBD>;<3B>;<3B> ?<3F> <10>K<EFBFBD>K<EFBFBD> <1D> <1D><16> <0B> <0B>F<EFBFBD>C<EFBFBD>M<EFBFBD>M<EFBFBD>$6<>$6<><03><0E><0E>8J<38>8J<38>A<EFBFBD>N<> <0E>!<21><14><1B><1B>a<EFBFBD>0<><14> <0C> <0C>T<EFBFBD>[<5B>[<5B>)<29>1<>  <20> <0A> <0B> <0B>J<EFBFBD><1F>1<EFBFBD>$<24><1F> <11> &<26> &<26>r<EFBFBD> *<2A> <10>K<EFBFBD>K<EFBFBD> <1D> <1D>f<EFBFBD>k<EFBFBD>k<EFBFBD>$<24><04> <0B> <0B>J<EFBFBD>0G<30>H<> I<>+<2B> *<2A> 1<>0<><30>  <20> <1F><>+<2B> *<2A>s2<00>BF<03> F<05><F<03>8AF<03>F <09>F<03>F<07>F#c <00>H<00>|jd<01>5|jjtjd|j
|j |jd|jd|jd|jd<00><00>ddd<06>y#1swYyxYw)z<>Write the DNS message header.
Writing the DNS message header is done after all sections
have been rendered, but before the optional TSIG signature
is added.
rz!HHHHHHrrrN)r@rr rCrDr!r"r(<00>r,s r<00> write_headerzRenderer.write_header=sy<00><00><12> &<26> &<26>q<EFBFBD> )<29> <10>K<EFBFBD>K<EFBFBD> <1D> <1D><16> <0B> <0B><1D><18>G<EFBFBD>G<EFBFBD><18>J<EFBFBD>J<EFBFBD><18>K<EFBFBD>K<EFBFBD><01>N<EFBFBD><18>K<EFBFBD>K<EFBFBD><01>N<EFBFBD><18>K<EFBFBD>K<EFBFBD><01>N<EFBFBD><18>K<EFBFBD>K<EFBFBD><01>N<EFBFBD><12>
<0E>*<2A> )<29> )<29>s <00>A=B<03>B!c<00>6<00>|jj<00>S)zReturn the wire format message.)rror<>s r<00>get_wirezRenderer.get_wireRs<00><00><14>{<7B>{<7B>#<23>#<23>%<25>%r.<00>size<7A>returnc<00><><00>|dkr td<02><00>||jkDr td<03><00>|xj|z c_|xj|zc_y)zReserve *size* bytes.rz$reserved amount must be non-negativez)cannot reserve more than the maximum sizeN)<03>
ValueErrorr#r*)r,r<>s r<00>reservezRenderer.reserveWsI<00><00> <0F>!<21>8<EFBFBD><1C>C<>D<> D<> <0F>$<24>-<2D>-<2D> <1F><1C>H<>I<> I<> <0C> <0A> <0A><14><1D> <0A> <0C> <0A> <0A><14><1D> r.c<00>P<00>|xj|jz c_d|_y)zRelease the reserved bytes.rN)r#r*r<>s r<00>release_reservedzRenderer.release_reserved`s<00><00> <0C> <0A> <0A><14><1D><1D>&<26> <0A><19><04> r.)NrrN)rrrr;)r<>N)<1D>__name__<5F>
__module__<EFBFBD> __qualname__<5F>__doc__r-r7r9<00>
contextlib<EFBFBD>contextmanagerr=r@rr<><00>INrHrNrRrgrlrq<00>default_algorithmr<6D>r<>rwr<>r<>rur<>r<><00>r.rrr:s<><00><00>*<08>X <20>& !<21> #<23><10><1E><1E>'<27><1F>'<27><10><1E><1E>&<26><1F>&<26>36<33>.<2E>.<2E>2C<32>2C<32>#<23>
"<22> "<22>(<28>2 <1A>(<16>(<28>(<28>,<2C>,<2C>(<28>F<16>(<28>(<28>,<2C>,<2C>!<13>FJ<01>$<0E>*&<26>
<1E>C<EFBFBD><1E>D<EFBFBD><1E>r.r)r<>r<>rrrCrv<00>dns.ednsr<00> dns.exception<6F>dns.rdataclass<73> dns.rdatatype<70>dns.tsigr&<00>ANSWER<45> AUTHORITYr_r<>rrr<>r.r<00><module>r<>sd<00><01>$1<><11> <09> <0A> <0A> <0B><0F><14><15><14><0F> <0A><08>
<EFBFBD><06> <0A> <09> <0E>
<EFBFBD> <0C><1A><1A><1D><1B><1D>"i<1A>ir.