Merge branch 'v3' into 'master'

V3 onion config

See merge request beardog/Onionr!6
This commit is contained in:
Kevin 2018-08-19 04:09:53 +00:00
commit e27265f2fc
7 changed files with 20 additions and 6 deletions

View File

@ -1,10 +1,10 @@
FROM ubuntu:xenial
FROM ubuntu:bionic
#Base settings
ENV HOME /root
#Install needed packages
RUN apt update && apt install -y python3 python3-dev python3-pip tor locales
RUN apt update && apt install -y python3 python3-dev python3-pip tor locales nano
RUN sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \
locale-gen

View File

@ -318,6 +318,8 @@ class OnionrCommunicatorDaemon:
self.addBootstrapListToPeerList(peerList)
for address in peerList:
if not config.get('tor.v3onions') and len(address) == 62:
continue
if len(address) == 0 or address in tried or address in self.onlinePeers:
continue
if self.shutdown:

View File

@ -18,7 +18,7 @@
along with this program. If not, see <https://www.gnu.org/licenses/>.
'''
import subprocess, os, random, sys, logger, time, signal
import subprocess, os, random, sys, logger, time, signal, config
from onionrblockapi import Block
class NetController:
@ -33,6 +33,7 @@ class NetController:
self.hsPort = hsPort
self._torInstnace = ''
self.myID = ''
config.reload()
'''
if os.path.exists(self.torConfigLocation):
torrc = open(self.torConfigLocation, 'r')
@ -47,11 +48,15 @@ class NetController:
'''
Generate a torrc file for our tor instance
'''
hsVer = '# v2 onions'
if config.get('tor.v3onions'):
hsVer = 'HiddenServiceVersion 3'
logger.info('Using v3 onions :)')
if os.path.exists(self.torConfigLocation):
os.remove(self.torConfigLocation)
torrcData = '''SocksPort ''' + str(self.socksPort) + '''
HiddenServiceDir data/hs/
\n''' + hsVer + '''\n
HiddenServicePort 80 127.0.0.1:''' + str(self.hsPort) + '''
DataDirectory data/tordata/
'''

View File

@ -247,6 +247,10 @@ class OnionrCrypto:
return result
def sha3Hash(self, data):
try:
data = data.encode()
except AttributeError:
pass
hasher = hashlib.sha3_256()
hasher.update(data)
return hasher.hexdigest()

View File

@ -43,7 +43,7 @@ class OnionrUtils:
self.avoidDupe = [] # list used to prevent duplicate requests per peer for certain actions
self.peerProcessing = {} # dict of current peer actions: peer, actionList
config.reload()
return
def getTimeBypassToken(self):
@ -128,6 +128,8 @@ class OnionrUtils:
for adder in newAdderList.split(','):
adder = adder.strip()
if not adder in self._core.listAdders(randomOrder = False) and adder != self.getMyAddress() and not self._core._blacklist.inBlacklist(adder):
if not config.get('tor.v3onions') and len(address) == 62:
continue
if self._core.addAddress(adder):
logger.info('Added %s to db.' % adder, timestamp = True)
retVal = True

View File

@ -108,6 +108,7 @@ class OnionrMail:
except KeyError:
pass
else:
cancel = ''
readBlock.verifySig()
print('Message recieved from %s' % (readBlock.signer,))
print('Valid signature:', readBlock.validSig)

View File

@ -41,7 +41,7 @@
},
"tor" : {
"v3onions": false
},
"i2p":{