print tor startup progress to term
This commit is contained in:
parent
572e29f5d5
commit
982ac88a72
@ -23,7 +23,7 @@ import filepaths
|
||||
DENIABLE_PEER_ADDRESS = "OVPCZLOXD6DC5JHX4EQ3PSOGAZ3T24F75HQLIUZSDSMYPEOXCPFA"
|
||||
PASSWORD_LENGTH = 25
|
||||
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_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.
|
||||
|
@ -21,6 +21,7 @@ from . import gentorrc
|
||||
from . import addbridges
|
||||
from . import torbinary
|
||||
from utils import identifyhome
|
||||
from utils import box_print
|
||||
"""
|
||||
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
|
||||
@ -41,9 +42,7 @@ addbridges = addbridges.add_bridges
|
||||
|
||||
|
||||
class NetController:
|
||||
"""
|
||||
This class handles hidden service setup on Tor
|
||||
"""
|
||||
"""Handle Tor daemon and onion service setup on Tor."""
|
||||
|
||||
def __init__(self, hsPort, apiServerIP='127.0.0.1'):
|
||||
# set data dir
|
||||
@ -90,6 +89,12 @@ class NetController:
|
||||
# wait for tor to get to 100% bootstrap
|
||||
try:
|
||||
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():
|
||||
logger.info(line.decode())
|
||||
break
|
||||
@ -110,6 +115,7 @@ class NetController:
|
||||
return False
|
||||
|
||||
logger.info('Finished starting Tor.', terminal=True)
|
||||
logger.info('Connecting to Onionr soon', terminal=True)
|
||||
|
||||
self.readyState = True
|
||||
|
||||
|
@ -0,0 +1 @@
|
||||
from .boxprint import bordered as box_print
|
8
src/utils/boxprint.py
Normal file
8
src/utils/boxprint.py
Normal file
@ -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
Block a user