bootstrap_iNmapInfo

This commit is contained in:
emdee 2022-10-18 00:16:56 +00:00
parent 4e44a559e7
commit 048caad578
3 changed files with 44 additions and 39 deletions

View File

@ -82,3 +82,6 @@ Others include:
To our point of view, the ability of CTYPEs to follow code in the
debugger is crucial.
Work on this project is suspended until the
[MultiDevice](https://git.plastiras.org/emdee/tox_profile/wiki/MultiDevice-Announcements-POC) problem is solved. Fork me!

View File

@ -4,6 +4,7 @@ import os
import sys
import argparse
import re
import traceback
import logging
import shutil
import json
@ -62,7 +63,8 @@ else:
# self._audio_thread.isAlive
iTHREAD_TIMEOUT = 1
iTHREAD_SLEEP = 1
iTHREAD_JOINS = 5
iTHREAD_JOINS = 8
iNODES=6
lToxSamplerates = [8000, 12000, 16000, 24000, 48000]
lToxSampleratesK = [8, 12, 16, 24, 48]
@ -70,6 +72,7 @@ lBOOLEANS = [
'local_discovery_enabled',
'udp_enabled',
'ipv6_enabled',
'trace_enabled',
'compact_mode',
'allow_inline',
'notifications',
@ -511,6 +514,41 @@ def bootstrap_tcp(lelts, lToxes):
else:
LOG.debug('bootstrap_tcp to ' +largs[0] +' not connected')
def bootstrap_iNmapInfo(lElts, oArgs, bIS_LOCAL=False, iNODES=iNODES):
if not bIS_LOCAL and not bAreWeConnected():
LOG.warn(f"bootstrap_iNmapInfo not local and NOT CONNECTED")
return True
env = dict()
if oArgs.proxy_type == 2:
protocol='socks'
elif oArgs.proxy_type == 1:
protocol='https'
else:
protocol='ipv4'
env = os.environ
lRetval = []
for elts in lElts[:iNODES]:
if elts[0] in lDEAD_BS: continue
iRet = -1
try:
iRet = iNmapInfo(protocol, *elts)
if iRet != 0:
LOG.warn('iNmapInfo to ' +repr(elts[0]) +' retval=' +str(iRet))
lRetval += [False]
else:
LOG.info(f'bootstrap_iNmapInfo '
+f" net={oArgs.network}"
+f" prot={protocol}"
+f" proxy={oArgs.proxy_type}"
+f' {elts[:2]!r}'
)
lRetval += [True]
except Exception as e:
LOG.error('iNmapInfo to ' +repr(elts[0]) +' : ' +str(e) \
+'\n' + traceback.format_exc())
lRetval += [False]
return any(lRetval)
def setup_logging(oArgs):
global LOG
if coloredlogs:

View File

@ -81,7 +81,6 @@ try:
except ImportError:
bIS_NOT_TOXYGEN = True
iNODES=8
# from PyQt5 import QtCore
if 'QtCore' in globals():
def qt_sleep(fSec):
@ -140,41 +139,6 @@ def iNmapInfo(sProt, sHost, sPort, key=None, environ=None, bTest=False):
LOG.debug(f"iNmapInfo: {s}")
return 0
def bootstrap_iNmapInfo(lElts):
if not bIS_LOCAL and not ts.bAreWeConnected():
LOG.warn(f"bootstrap_iNmapInfo not local and NOT CONNECTED")
return True
env = dict()
if oTOX_OARGS.proxy_type == 2:
protocol='socks'
elif oTOX_OARGS.proxy_type == 1:
protocol='https'
else:
protocol='ipv4'
env = os.environ
lRetval = []
for elts in lElts[:iNODES]:
if elts[0] in ts.lDEAD_BS: continue
iRet = -1
try:
iRet = iNmapInfo(protocol, *elts)
if iRet != 0:
LOG.warn('iNmapInfo to ' +repr(elts[0]) +' retval=' +str(iRet))
lRetval += [False]
else:
LOG.info(f'bootstrap_iNmapInfo '
+f" net={oTOX_OARGS.network}"
+f" prot={protocol}"
+f" proxy={oTOX_OARGS.proxy_type}"
+f' {elts[:2]!r}'
)
lRetval += [True]
except Exception as e:
LOG.error('iNmapInfo to ' +repr(elts[0]) +' : ' +str(e) \
+'\n' + traceback.format_exc())
lRetval += [False]
return any(lRetval)
class ToxOptions():
def __init__(self):
self.ipv6_enabled = True
@ -816,8 +780,8 @@ class ToxSuite(unittest.TestCase):
lRetval = []
random.shuffle(lElts)
# assert
bootstrap_iNmapInfo(lElts)
ts.bootstrap_iNmapInfo(lElts, oTOX_OARGS, bIS_LOCAL, iNODES=8)
def test_self_get_secret_key(self): # works
"""
t:self_get_secret_key