ó {ŒwNc@s¡dZddlmZddlmZdejfd„ƒYZdefd„ƒYZdejfd „ƒYZ d efd „ƒYZ d ej fd „ƒYZ dS(s A simple port forwarder. iÿÿÿÿ(tprotocol(tlogtProxycBs/eZeZdZd„Zd„Zd„ZRS(cCs ||_dS(N(tpeer(tselfR((sA/usr/lib/python2.7/dist-packages/twisted/protocols/portforward.pytsetPeerscCsO|jdk r+|jjjƒd|_n |jrKtjd|fƒndS(NsUnable to connect to peer: %s(RtNonet transporttloseConnectiontnoisyRtmsg(Rtreason((sA/usr/lib/python2.7/dist-packages/twisted/protocols/portforward.pytconnectionLosts   cCs|jjj|ƒdS(N(RRtwrite(Rtdata((sA/usr/lib/python2.7/dist-packages/twisted/protocols/portforward.pyt dataReceivedsN( t__name__t __module__tTrueR RRRR R(((sA/usr/lib/python2.7/dist-packages/twisted/protocols/portforward.pyR s   t ProxyClientcBseZd„ZRS(cCsV|jj|ƒ|jj|jjtƒ|jjj|jtƒ|jjjƒdS(N(RRRtregisterProducerRtresumeProducing(R((sA/usr/lib/python2.7/dist-packages/twisted/protocols/portforward.pytconnectionMade s(RRR(((sA/usr/lib/python2.7/dist-packages/twisted/protocols/portforward.pyRstProxyClientFactorycBs)eZeZd„Zd„Zd„ZRS(cCs ||_dS(N(tserver(RR((sA/usr/lib/python2.7/dist-packages/twisted/protocols/portforward.pyt setServer1scOs,tjj|||Ž}|j|jƒ|S(N(Rt ClientFactoryt buildProtocolRR(Rtargstkwtprot((sA/usr/lib/python2.7/dist-packages/twisted/protocols/portforward.pyR4scCs|jjjƒdS(N(RRR(Rt connectorR ((sA/usr/lib/python2.7/dist-packages/twisted/protocols/portforward.pytclientConnectionFailed9s(RRRRRRR (((sA/usr/lib/python2.7/dist-packages/twisted/protocols/portforward.pyR-s  t ProxyServercBseZeZdZd„ZRS(cCsw|jjƒ|jƒ}|j|ƒ|jdkrQddlm}||_n|jj|jj |jj |ƒdS(Niÿÿÿÿ(treactor( RtpauseProducingtclientProtocolFactoryRR"Rttwisted.internett connectTCPtfactorythosttport(RtclientR"((sA/usr/lib/python2.7/dist-packages/twisted/protocols/portforward.pyRBs    N(RRRR$RR"R(((sA/usr/lib/python2.7/dist-packages/twisted/protocols/portforward.pyR!=st ProxyFactorycBseZdZeZd„ZRS(sFactory for port forwarder.cCs||_||_dS(N(R(R)(RR(R)((sA/usr/lib/python2.7/dist-packages/twisted/protocols/portforward.pyt__init__Us (RRt__doc__R!RR,(((sA/usr/lib/python2.7/dist-packages/twisted/protocols/portforward.pyR+PsN( R-R%Rttwisted.pythonRtProtocolRRRRR!tFactoryR+(((sA/usr/lib/python2.7/dist-packages/twisted/protocols/portforward.pyts