From 0b192ffb9be6d3eab00aba82e4e36c0025e9533d Mon Sep 17 00:00:00 2001 From: Kevin Froman Date: Sun, 1 Apr 2018 00:46:34 -0500 Subject: [PATCH] do not request offline peers too often and updated logo --- docs/onionr-logo.png | Bin 9633 -> 5147 bytes onionr/communicator.py | 16 ++++++++++------ onionr/onionrutils.py | 31 +++++++++++++++++++++++-------- 3 files changed, 33 insertions(+), 14 deletions(-) diff --git a/docs/onionr-logo.png b/docs/onionr-logo.png index f52533f091c27640a81b34b5b156e64d7cf38f3e..51060c6a81fcdc2b54203140de967c0336453be9 100644 GIT binary patch literal 5147 zcmb7I=Q|q?v__3st-Yx&wvbfR-lb?M6>5j7YD;RA*s&snnx*!vE%>QYqgK!&lv=G) zdvAgwxA#A|_dL&e-w)@*dCq%2oaa4p56ui2>3HbK$jBIt?&(?l7Wc$XRHk!lfx*1_H@v z)cBlVzzNemLjeNB5P{CM-&J8bo^M=MyX}&8eB`b|N~(f(XObF;cjrGhojPna>szH~ zWT>OEPRML+{dJ|MGt~9}-w>UBLY615asA=8>q|H6plE-rR*IX<-jmhXuw(v40o!kG zf=78ZC#zevEu_kxSVzAf-@F#An&(FB_mESGewzD1o!{zXZ~uwwPXyW7l;$j-6`+|X zZ0+8UIyx+lCik>$v)3(@D*yUYGf%vd|K(~cm)*j#tx5Wwy%&b4BUW~*_{GFoH%Qkm zwC=TJ?X{e6{JwZZ+TK9kzVPZC7I6#=_X^(Gs?KvP6fhmd!ygKR(122@KmesX$ipOT zUeUU9`L2V{PvXHy{^bn!NQ0a5P>s{xRkEthwjUJ2=R>Mz&3W?ErK)`0-cPI!*+cXh zuW5dmmKVEAQoQx+jb_i0XIi%IW`i&|k136;T#6P2SYp5m_bJq26Gfj)@|5_R$pM+5-)v^as;08|M(W=&*~r zFa*BQ>)d~+)X6Jk=449DEt*}Z{4I~}6u`r^zA`6x+5GX8vWtv>FSM7C}i~YG&+~75%Iq+tx()sVMX{RvoWDlN3Bz|J(jzN9XT-bss1Y z3UHi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|LFZv-ze&GNgT%|tpme30}E*8*HMC#JK$*}Lu<<~Qa3z2_) zLgjXihUfx{P~+2zI8TH@za%XzDq?3qgleTixut}pma%wf4}%Cue|>bXP$W`H{N(7alH0&=Wh9Yq|=t4pD|+wC!KT>OBOHYn_nBp z#s6@oZyc9ejDt$Kj7w7DrUI%M5yf#`e^|kVt}!b1Ru|>rD^cX#U|OeRl~Q0GE=g+p z#82}CGB(zCP|Oq?@fKH7OIl5MdH#ExebZHZ^vN>5^PTVTlb`&gdr{<#SUOE%0p`w~ z%Lyl(z??aA7`?~d{QTSh%vQ~Vu$3x>LV?n%)ud^P){0_}9)95ttw9MEK}9O`g!R=2 zskM3KYgQc)8Lvz^TMLgY_ysf^M(L2a2mxHi!V2luG)bsdDp)7nG4)Zd{{6iuW4QL( zYdPzzvueI^w``QssR|3Qa^*_C{q1ja#~pXjuUBt=aM~H1a_A96!50fX*C-Zs{WFbcF>U7~Og2om_O$MJ!&tn7ww~g-iZn zBKz$&0woZuC@)n>DitCm@8WHmVx$nz1_d^)B54XruDXim=H|{Gf^O*|=@Ny_WZ}Yv{P2fA z*Y$O_d_wCe@luJG+GMcDZz!VDWC#~ud@&OzPNYy+ zd)-sFY@E{N3Y&?D@ZyUva@AE=asU1IQ!bZjDiqjv*Wnz#_r4r7YdhqLbHyQl`=2B_a-x5dzs0zo?+24UlTQQto22Q1N!!3__jmYdB`?wyTxF(8aRmN zKK;dU4LNV8H?&d+af$PoK`S&pylCxpUk0;mV2LwPZr;+a54r0Ha2Y zV)W?I9DexWj2t<#8~pz}l+RURTZ^@p6)RTo`s=Ur?z`{u?z``@Y}qoFELlRiTt-BQ z0pJFw%9J2H6iVDIyO#*H1i<+GKIN@2UDTh=Arm`=C+uaf@{ XqTw6@OrUvD00000NkvXXu0mjfOThin diff --git a/onionr/communicator.py b/onionr/communicator.py index 9c2b88b7..d42b70a4 100755 --- a/onionr/communicator.py +++ b/onionr/communicator.py @@ -108,7 +108,7 @@ class OnionrCommunicate: i = random.randint(0, maxN) logger.info('Using ' + peerList[i] + ' to find new peers') try: - newAdders = self.performGet('pex', peerList[i]) + newAdders = self.performGet('pex', peerList[i], skipHighFailureAddress=True) self._utils.mergeAdders(newAdders) except requests.exceptions.ConnectionError: logger.info(peerList[i] + ' connection failed') @@ -116,7 +116,7 @@ class OnionrCommunicate: else: try: logger.info('Using ' + peerList[i] + ' to find new keys') - newKeys = self.performGet('kex', peerList[i]) + newKeys = self.performGet('kex', peerList[i], skipHighFailureAddress=True) # TODO: Require keys to come with POW token (very large amount of POW) self._utils.mergeKeys(newKeys) except requests.exceptions.ConnectionError: @@ -217,7 +217,7 @@ class OnionrCommunicate: return urllib.parse.quote_plus(data) - def performGet(self, action, peer, data=None, peerType='tor'): + def performGet(self, action, peer, data=None, skipHighFailureAddress=False, peerType='tor'): ''' Performs a request to a peer through Tor or i2p (currently only Tor) ''' @@ -229,7 +229,6 @@ class OnionrCommunicate: if not peer in self.peerData: self.peerData[peer] = {'connectCount': 0, 'failCount': 0, 'lastConnectTime': math.floor(time.time())} socksPort = sys.argv[2] - logger.debug('Contacting ' + peer + ' on port ' + socksPort) '''We use socks5h to use tor as DNS''' proxies = {'http': 'socks5://127.0.0.1:' + str(socksPort), 'https': 'socks5://127.0.0.1:' + str(socksPort)} headers = {'user-agent': 'PyOnionr'} @@ -237,8 +236,13 @@ class OnionrCommunicate: if data != None: url = url + '&data=' + self.urlencode(data) try: - r = requests.get(url, headers=headers, proxies=proxies, timeout=(15, 30)) - retData = r.text + if skipHighFailureAddress and self.peerData[peer]['failCount'] > 10: + retData = False + logger.debug('Skipping ' + peer + ' because of high failure rate') + else: + logger.debug('Contacting ' + peer + ' on port ' + socksPort) + r = requests.get(url, headers=headers, proxies=proxies, timeout=(15, 30)) + retData = r.text except requests.exceptions.RequestException as e: logger.warn(action + " failed with peer " + peer + ": " + str(e)) retData = False diff --git a/onionr/onionrutils.py b/onionr/onionrutils.py index 051ad193..c82a39e2 100644 --- a/onionr/onionrutils.py +++ b/onionr/onionrutils.py @@ -40,23 +40,38 @@ class OnionrUtils: def sendPM(self, user, message): '''High level function to encrypt a message to a peer and insert it as a block''' return + + def incrementAddressSuccess(self, address): + '''Increase the recorded sucesses for an address''' + increment = self._core.getAddressInfo(address, 'success') + 1 + self._core.setAddressInfo(address, 'success', increment) + return + + def decrementAddressSuccess(self, address): + '''Decrease the recorded sucesses for an address''' + increment = self._core.getAddressInfo(address, 'success') - 1 + self._core.setAddressInfo(address, 'success', increment) + return def mergeKeys(self, newKeyList): '''Merge ed25519 key list to our database''' retVal = False - for key in newKeyList: - if not key in self._core.listPeers(randomOrder=False): - if self._core.addPeer(key): - retVal = True + if newKeyList != False: + for key in newKeyList: + if not key in self._core.listPeers(randomOrder=False): + if self._core.addPeer(key): + retVal = True return retVal + def mergeAdders(self, newAdderList): '''Merge peer adders list to our database''' retVal = False - for adder in newAdderList: - if not adder in self._core.listAdders(randomOrder=False): - if self._core.addAddress(adder): - retVal = True + if newAdderList != False: + for adder in newAdderList: + if not adder in self._core.listAdders(randomOrder=False): + if self._core.addAddress(adder): + retVal = True return retVal def localCommand(self, command):