U mf&@sddlmZmZddlmZddlZddlZddlZddl Zddl ZGdddZ Gddde Z Gdd d e Z Gd d d e ZGd d d e ZGddde ZdS))OptionalUnion)urlparseNc @seZdZddZddZedddZeddd Zedd d Z e dd d Z de j jeeee eeee j jdddZde j jeeee ee jjeee j jd ddZdS) NameservercCsdSNselfrr  rcsdeZdZeedfdd ZedddZedddZd d Z edd d Z edd dZ Z S)AddressAndPortNameserveraddressportcst||_||_dSr)superr r2r3r r2r3 __class__rr r 9s z!AddressAndPortNameserver.__init__rcCstdSrr rrrr r>szAddressAndPortNameserver.kindcCsdS)NFrrrrr rAsz+AddressAndPortNameserver.is_always_max_sizecCs |}|d|jd|jS)N:@)rr2r3)r Zns_kindrrr rDsz AddressAndPortNameserver.__str__cCs|jSr)r2rrrr rHsz*AddressAndPortNameserver.answer_nameservercCs|jSr)r3rrrr rKsz$AddressAndPortNameserver.answer_port) r#r$r%r&r(r rr'rrrr __classcell__rrr6r r08s r0c seZdZdeedfdd ZddZdejj e e eee e e ejj dd d Zdejj e e eee ejje e ejj d d d ZZS)Do53Nameserver5r1cst||dSr)r4r r5r6rr r PszDo53Nameserver.__init__cCsdS)NZDo53rrrrr rSszDo53Nameserver.kindFrc CsP|r&tjj||j||j||||d}n&tjj||j||j||d||ddd }|S)N)rr3rrrrT) rr3rrraise_on_truncationrr ignore_errorsignore_unexpected)r)rtcpr2r3udp) r rrrrrrrresponserrr rVs2   zDo53Nameserver.queryrc s`|r.tjj||j||j|||||d IdH} n.tjj||j||j||d|||ddd IdH} | S)N)rr3rrr rrT) rr3rrr=r rrr>r?)r) asyncqueryr@r2r3rA) r rrrrrr rrrBrrr r"{s6   zDo53Nameserver.async_query)r<)FF)FF)r#r$r%r&r(r rr)r*r+r,rr'r-rr.r/r"r:rrr6r r;Os6  -r;c seZdZdeeeeeefedfdd ZddZed d d Z d d Z ed ddZ e d ddZ dejjeeee eeeejjdddZdejjeeee eejjeeejjd ddZZS) DoHNameserverNTF)urlbootstrap_addressverifywant_getcs&t||_||_||_||_dSr)r4r rErFrGrH)r rErFrGrHr6rr r s  zDoHNameserver.__init__cCsdS)NZDoHrrrrr rszDoHNameserver.kindrcCsdS)NTrrrrr rsz DoHNameserver.is_always_max_sizecCs|jSrrErrrr rszDoHNameserver.__str__cCs|jSrrIrrrr rszDoHNameserver.answer_nameservercCst|jj}|dkrd}|S)Ni)rrEr3)r r3rrr rs zDoHNameserver.answer_portrc Cs*tjj||j||||j|||j|j d SN)rrrrFrrrGpost)r)rhttpsrErFrGrHrrrr rs zDoHNameserver.queryrc s0tjj||j||||j|||j|j d IdHSrJ)r)rCrLrErFrGrHr!rrr r"s zDoHNameserver.async_query)NTF)FFF)FF)r#r$r%r&rrr'r rrrrr(rr)r*r+r,r-rr.r/r"r:rrr6r rDsP    rDc seZdZdeeeeeeefdfdd ZddZ de j j e eeeeeee j jd d d Zde j j e eeeee jjeee j jd ddZZS) DoTNameserverUNT)r2r3hostnamerGcst||||_||_dSr)r4r rOrG)r r2r3rOrGr6rr r szDoTNameserver.__init__cCsdS)NZDoTrrrrr rszDoTNameserver.kindFrc Cs$tjj||j|j||||j|jdSN)r3rrrserver_hostnamerG)r)rtlsr2r3rOrGrrrr rs zDoTNameserver.queryrc s*tjj||j|j||||j|jdIdHSrP)r)rCrRr2r3rOrGr!rrr r"s zDoTNameserver.async_query)rNNT)FFF)FF)r#r$r%r&r(rrr'r rr)r*r+r,r-rr.r/r"r:rrr6r rMsH    rMc seZdZdeeeeefeedfdd ZddZ de j j e eeeeeee j jd d d Zde j j e eeeee jjeee j jd ddZZS) DoQNameserverrNTN)r2r3rGrQcst||||_||_dSr)r4r rGrQ)r r2r3rGrQr6rr r 0szDoQNameserver.__init__cCsdS)NZDoQrrrrr r;szDoQNameserver.kindFrc Cs$tjj||j|j||||j|jdSN)r3rrrrGrQ)r)rquicr2r3rGrQrrrr r>s zDoQNameserver.queryrc s*tjj||j|j||||j|jdIdHSrT)r)rCrUr2r3rGrQr!rrr r"Ss zDoQNameserver.async_query)rNTN)FFF)FF)r#r$r%r&r(rr'rr rr)r*r+r,r-rr.r/r"r:rrr6r rS/sH    rS)typingrr urllib.parserZdns.asyncbackendr)Zdns.asyncqueryZdns.inetZ dns.messageZ dns.queryrr0r;rDrMrSrrrr s -UP;