print tor startup progress to term
parent
572e29f5d5
commit
982ac88a72
|
@ -23,7 +23,7 @@ import filepaths
|
||||||
DENIABLE_PEER_ADDRESS = "OVPCZLOXD6DC5JHX4EQ3PSOGAZ3T24F75HQLIUZSDSMYPEOXCPFA"
|
DENIABLE_PEER_ADDRESS = "OVPCZLOXD6DC5JHX4EQ3PSOGAZ3T24F75HQLIUZSDSMYPEOXCPFA"
|
||||||
PASSWORD_LENGTH = 25
|
PASSWORD_LENGTH = 25
|
||||||
ONIONR_TAGLINE = 'Private P2P Communication - GPLv3 - https://Onionr.net'
|
ONIONR_TAGLINE = 'Private P2P Communication - GPLv3 - https://Onionr.net'
|
||||||
ONIONR_VERSION = '3.0.0'
|
ONIONR_VERSION = '3.1.0'
|
||||||
ONIONR_VERSION_CODENAME = 'Genesis'
|
ONIONR_VERSION_CODENAME = 'Genesis'
|
||||||
ONIONR_VERSION_TUPLE = tuple(ONIONR_VERSION.split('.')) # (MAJOR, MINOR, VERSION)
|
ONIONR_VERSION_TUPLE = tuple(ONIONR_VERSION.split('.')) # (MAJOR, MINOR, VERSION)
|
||||||
API_VERSION = '1' # increments of 1; only change when something fundamental about how the API works changes. This way other nodes know how to communicate without learning too much information about you.
|
API_VERSION = '1' # increments of 1; only change when something fundamental about how the API works changes. This way other nodes know how to communicate without learning too much information about you.
|
||||||
|
|
|
@ -21,6 +21,7 @@ from . import gentorrc
|
||||||
from . import addbridges
|
from . import addbridges
|
||||||
from . import torbinary
|
from . import torbinary
|
||||||
from utils import identifyhome
|
from utils import identifyhome
|
||||||
|
from utils import box_print
|
||||||
"""
|
"""
|
||||||
This program is free software: you can redistribute it and/or modify
|
This program is free software: you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
|
@ -41,9 +42,7 @@ addbridges = addbridges.add_bridges
|
||||||
|
|
||||||
|
|
||||||
class NetController:
|
class NetController:
|
||||||
"""
|
"""Handle Tor daemon and onion service setup on Tor."""
|
||||||
This class handles hidden service setup on Tor
|
|
||||||
"""
|
|
||||||
|
|
||||||
def __init__(self, hsPort, apiServerIP='127.0.0.1'):
|
def __init__(self, hsPort, apiServerIP='127.0.0.1'):
|
||||||
# set data dir
|
# set data dir
|
||||||
|
@ -90,6 +89,12 @@ class NetController:
|
||||||
# wait for tor to get to 100% bootstrap
|
# wait for tor to get to 100% bootstrap
|
||||||
try:
|
try:
|
||||||
for line in iter(tor.stdout.readline, b''):
|
for line in iter(tor.stdout.readline, b''):
|
||||||
|
for word in ('bootstrapped', '%'):
|
||||||
|
if word not in line.decode().lower():
|
||||||
|
break
|
||||||
|
else:
|
||||||
|
if '100' not in line.decode():
|
||||||
|
logger.info(line.decode().strip(), terminal=True)
|
||||||
if 'bootstrapped 100' in line.decode().lower():
|
if 'bootstrapped 100' in line.decode().lower():
|
||||||
logger.info(line.decode())
|
logger.info(line.decode())
|
||||||
break
|
break
|
||||||
|
@ -110,6 +115,7 @@ class NetController:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
logger.info('Finished starting Tor.', terminal=True)
|
logger.info('Finished starting Tor.', terminal=True)
|
||||||
|
logger.info('Connecting to Onionr soon', terminal=True)
|
||||||
|
|
||||||
self.readyState = True
|
self.readyState = True
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
from .boxprint import bordered as box_print
|
|
@ -0,0 +1,8 @@
|
||||||
|
def bordered(text):
|
||||||
|
lines = text.splitlines()
|
||||||
|
width = max(len(s) for s in lines)
|
||||||
|
res = ['┌' + '─' * width + '┐']
|
||||||
|
for s in lines:
|
||||||
|
res.append('│' + (s + ' ' * width)[:width] + '│')
|
||||||
|
res.append('└' + '─' * width + '┘')
|
||||||
|
return '\n'.join(res)
|
Loading…
Reference in New Issue