HEX
Server: Apache
System: Linux p102.lithium.hosting 4.18.0-553.141.1.el8_10.x86_64 #1 SMP Fri Jul 10 17:48:02 UTC 2026 x86_64
User: bvzmoamr (9955)
PHP: 8.1.34
Disabled: syslog
Upload Files
File: //proc/self/root/usr/lib64/python2.7/site-packages/hgext/zeroconf/__init__.pyo
�
1�3\c@@szdZddlmZddlZddlZddlZddlmZddlm	Z	m
Z
mZmZm
ZddlmZdZdadad	�Zd
�Zd�Zdefd
��YZd�Zd�Zd�Zd�Zd�Zd�Zej e	de�ej ej
de�ej ej
de�ej ej
de�ej ede�ej ede�dS(s�discover and advertise repositories on the local network

Zeroconf-enabled repositories will be announced in a network without
the need to configure a server or a service. They can be discovered
without knowing their actual IP address.

To allow other people to discover your repository using run
:hg:`serve` in your repository::

  $ cd test
  $ hg serve

You can discover Zeroconf-enabled repositories by running
:hg:`paths`::

  $ hg paths
  zc-test = http://example.com:8000/test
i(tabsolute_importNi(tZeroconf(tdispatchtencodingt
extensionsthgtui(tserversships-with-hg-corecC@sy=tjtjtj�}|jd�|j�d}|SWntjk
rSnXyItjtj��dd}d|kr�d}n|jd�s�|SWn#tj	tj
fk
r�d}nXy=tjtjtj�}|jd	�|j�d}|SWntjk
rnX|S(
Ns1.0.0.1iit:s	127.0.0.1s127.i(s1.0.0.1i(s1.0.0.1i(tsockettAF_INETt
SOCK_DGRAMtconnecttgetsocknameterrort
gethostbyaddrtgethostnamet
startswithtgaierrortherror(tstiptdumbip((s=/usr/lib64/python2.7/site-packages/hgext/zeroconf/__init__.pytgetip6s.
	

cC@s,tsCt�}|jd�r"dStj|�atj|�antj�jd�d}|d}d||f}tj	d|dd|d	|d
i|d6d|d
6dtdddd�}tj
|�tj	d|dd|d	|d
i|d6d|d
6dtdddd�}tj
|�dS(Ns127.t.is.locals%s-%ss_http._tcp.local.s._http._tcp.local.Rtportt
propertiestdescriptiont/tpathtaddresstweighttprioritys_hg._tcp.local.s._hg._tcp.local.(RRRR	t	inet_atontlocalipRRtsplittServiceInfotregisterService(tnametdescRRRthostnamethosttsvc((s=/usr/lib64/python2.7/site-packages/hgext/zeroconf/__init__.pytpublishUs2	
	


	

cC@s�|||�}|j}y
|j}Wn�tk
r�|j��j}|jp_tjj|j�}|j	j
ddd�jd�}|j	j
dd�}	|	s�|}	nWdQXt||	||�n�X|j	j
ddd�jd�d}
x�|D]�\}}|j	j
�}|jtjj|dd��tjj|�}|
|jd�}|j
dd�}	|	sp|}	nt||	||�q�W|S(NtwebtprefixtRRs.hgthgrc(RtrepostAttributeErrort_obtainrepotreponametosRtbasenametrootRtconfigtstripR+tcopyt
readconfigtjoin(t
create_serverRtappthttpdRR0trepoR&RR'R-tu((s=/usr/lib64/python2.7/site-packages/hgext/zeroconf/__init__.pytzc_create_serverws.	

!%	tlistenercB@s#eZd�Zd�Zd�ZRS(cC@s
i|_dS(N(tfound(tself((s=/usr/lib64/python2.7/site-packages/hgext/zeroconf/__init__.pyt__init__�scC@s,t|�|jkr(|jt|�=ndS(N(treprRC(RDRttypeR&((s=/usr/lib64/python2.7/site-packages/hgext/zeroconf/__init__.pyt
removeService�scC@s#|j||�|jt|�<dS(N(tgetServiceInfoRCRF(RDRRGR&((s=/usr/lib64/python2.7/site-packages/hgext/zeroconf/__init__.pyt
addService�s(t__name__t
__module__RERHRJ(((s=/usr/lib64/python2.7/site-packages/hgext/zeroconf/__init__.pyRB�s		cc@s�t�}|jd�rdStj|�}t�}tj|d|�tjd�|j�xp|jj	�D]_}|j
|j
jd� }dtj
|j�|j|jjdd�f}d||fVqnWdS(	Ns127.s_hg._tcp.local.iRshttp://%s:%s%sRRszc-(RRRRBtServiceBrowserttimetsleeptcloseRCtvaluesR&tindexR	t	inet_ntoaRRRtget(RRtltvalueR&turl((s=/usr/lib64/python2.7/site-packages/hgext/zeroconf/__init__.pyt
getzcpaths�s		

cO@s^|dkrH|jd�rHx*t�D]\}}||kr%|Sq%Wn||||||�S(Ntpathsszc-(RRX(torigRDtsectiontkeytargstkwargsR&R((s=/usr/lib64/python2.7/site-packages/hgext/zeroconf/__init__.pyR7�s
cO@s5|||||�}|dkr1|t�7}n|S(NRY(RX(RZRDR[R]R^R0((s=/usr/lib64/python2.7/site-packages/hgext/zeroconf/__init__.pytconfigitems�sc
O@sv||||||�\}}|dkrl|jd�rlx0t�D]"\}}	||krC|	|fSqCWn||fS(NRYszc-(RRX(
RZRDR[R&R]R^topttsubtzcnametzcurl((s=/usr/lib64/python2.7/site-packages/hgext/zeroconf/__init__.pytconfigsuboptions�scC@s@x3t�D](\}}||kr
|jtj�Sq
W||�S(N(RXtencodeR(RZtsourceR&R((s=/usr/lib64/python2.7/site-packages/hgext/zeroconf/__init__.pytdefaultdest�scC@s2z|||||�SWdtr-tj�nXdS(N(RRP(RZRtoptionstcmdtcmdfunc((s=/usr/lib64/python2.7/site-packages/hgext/zeroconf/__init__.pytcleanupafterdispatch�st_runcommandR7R_RdRgR<(!t__doc__t
__future__RR4R	RNR.Rt	mercurialRRRRRtuimodtmercurial.hgwebRt	servermodt
testedwithtNoneR"RR+RAtobjectRBRXR7R_RdRgRktwrapfunction(((s=/usr/lib64/python2.7/site-packages/hgext/zeroconf/__init__.pyt<module>s4(		"