Updated domains
This commit is contained in:
parent
7764404b9a
commit
ad59434927
@ -18,7 +18,7 @@ except ImportError:
|
|||||||
d = os.environ.get('TOXCORE_LIBS', '')
|
d = os.environ.get('TOXCORE_LIBS', '')
|
||||||
if d and os.path.exists(d):
|
if d and os.path.exists(d):
|
||||||
sLIBS_DIR = d
|
sLIBS_DIR = d
|
||||||
if os.environ.get('DEBUG', ''):
|
if os.environ.get('DEBUG', ''):
|
||||||
print ('DBUG: Setting TOXCORE_LIBS to ' +d)
|
print ('DBUG: Setting TOXCORE_LIBS to ' +d)
|
||||||
del d
|
del d
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ except ImportError:
|
|||||||
lNO_PROXY = ['localhost', '127.0.0.1']
|
lNO_PROXY = ['localhost', '127.0.0.1']
|
||||||
CONNECT_TIMEOUT = 20.0
|
CONNECT_TIMEOUT = 20.0
|
||||||
|
|
||||||
def bAreWeConnected():
|
def bAreWeConnected():
|
||||||
# FixMe: Linux only
|
# FixMe: Linux only
|
||||||
sFile = f"/proc/{os.getpid()}/net/route"
|
sFile = f"/proc/{os.getpid()}/net/route"
|
||||||
if not os.path.isfile(sFile): return None
|
if not os.path.isfile(sFile): return None
|
||||||
@ -70,10 +70,10 @@ def pick_up_proxy_from_environ():
|
|||||||
|
|
||||||
def download_url(url, settings=None):
|
def download_url(url, settings=None):
|
||||||
if not bAreWeConnected(): return ''
|
if not bAreWeConnected(): return ''
|
||||||
|
|
||||||
if settings is None:
|
if settings is None:
|
||||||
settings = pick_up_proxy_from_environ()
|
settings = pick_up_proxy_from_environ()
|
||||||
|
|
||||||
if pycurl:
|
if pycurl:
|
||||||
LOG.debug('Downloading with pycurl: ' + str(url))
|
LOG.debug('Downloading with pycurl: ' + str(url))
|
||||||
buffer = BytesIO()
|
buffer = BytesIO()
|
||||||
@ -161,4 +161,4 @@ def download_url(url, settings=None):
|
|||||||
return ''
|
return ''
|
||||||
|
|
||||||
return ''
|
return ''
|
||||||
|
|
||||||
|
@ -33,41 +33,41 @@ bHAVE_TORR = shutil.which('tor-resolve')
|
|||||||
# in the wild we'll keep a copy here so we can avoid restesting
|
# in the wild we'll keep a copy here so we can avoid restesting
|
||||||
yKNOWN_NODNS = """
|
yKNOWN_NODNS = """
|
||||||
---
|
---
|
||||||
- 0x0.is
|
- heraldonion.org
|
||||||
- a9.wtf
|
- linkspartei.org
|
||||||
- aklad5.com
|
- pineapple.cx
|
||||||
- artikel5ev.de
|
|
||||||
- arvanode.net
|
|
||||||
- dodo.pm
|
|
||||||
- dra-family.github.io
|
|
||||||
- eraldonion.org
|
|
||||||
- erjan.net
|
|
||||||
- galtland.network
|
|
||||||
- ineapple.cx
|
|
||||||
- lonet.sh
|
|
||||||
- moneneis.de
|
|
||||||
- olonet.sh
|
|
||||||
- or-exit-2.aa78i2efsewr0neeknk.xyz
|
|
||||||
- or.wowplanet.de
|
|
||||||
- ormycloud.org
|
|
||||||
- plied-privacy.net
|
|
||||||
- rivacysvcs.net
|
|
||||||
- redacted.org
|
|
||||||
- rification-for-nusenu.net
|
|
||||||
- rofl.cat
|
|
||||||
- rsv.ch
|
|
||||||
- sv.ch
|
|
||||||
- thingtohide.nl
|
- thingtohide.nl
|
||||||
- tikel10.org
|
|
||||||
- tor.wowplanet.de
|
|
||||||
- tor-exit-2.aa78i2efsewr0neeknk.xyz
|
- tor-exit-2.aa78i2efsewr0neeknk.xyz
|
||||||
- tor-exit-3.aa78i2efsewr0neeknk.xyz
|
- tor-exit-3.aa78i2efsewr0neeknk.xyz
|
||||||
- torix-relays.org
|
- tor.dlecan.com
|
||||||
- tse.com
|
|
||||||
- tuxli.org
|
- tuxli.org
|
||||||
- w.digidow.eu
|
- verification-for-nusenu.net
|
||||||
- w.cccs.de
|
|
||||||
"""
|
"""
|
||||||
|
# - 0x0.is
|
||||||
|
# - a9.wtf
|
||||||
|
# - aklad5.com
|
||||||
|
# - artikel5ev.de
|
||||||
|
# - arvanode.net
|
||||||
|
# - dodo.pm
|
||||||
|
# - erjan.net
|
||||||
|
# - galtland.network
|
||||||
|
# - lonet.sh
|
||||||
|
# - moneneis.de
|
||||||
|
# - olonet.sh
|
||||||
|
# - or-exit-2.aa78i2efsewr0neeknk.xyz
|
||||||
|
# - or.wowplanet.de
|
||||||
|
# - ormycloud.org
|
||||||
|
# - plied-privacy.net
|
||||||
|
# - rivacysvcs.net
|
||||||
|
# - redacted.org
|
||||||
|
# - rofl.cat
|
||||||
|
# - sv.ch
|
||||||
|
# - tikel10.org
|
||||||
|
# - tor.wowplanet.de
|
||||||
|
# - torix-relays.org
|
||||||
|
# - tse.com
|
||||||
|
# - w.digidow.eu
|
||||||
|
# - w.cccs.de
|
||||||
|
|
||||||
def oMakeController(sSock='', port=9051):
|
def oMakeController(sSock='', port=9051):
|
||||||
import getpass
|
import getpass
|
||||||
@ -86,13 +86,15 @@ def oGetStemController(log_level=10, sock_or_pair='/run/tor/control'):
|
|||||||
global oSTEM_CONTROLER
|
global oSTEM_CONTROLER
|
||||||
if oSTEM_CONTROLER: return oSTEM_CONTROLER
|
if oSTEM_CONTROLER: return oSTEM_CONTROLER
|
||||||
import stem.util.log
|
import stem.util.log
|
||||||
stem.util.log.Runlevel = log_level
|
# stem.util.log.Runlevel = 'DEBUG' = 20 # log_level
|
||||||
|
|
||||||
if os.path.exists(sock_or_pair):
|
if os.path.exists(sock_or_pair):
|
||||||
LOG.info(f"controller from socket {sock_or_pair}")
|
LOG.info(f"controller from socket {sock_or_pair}")
|
||||||
controller = Controller.from_socket_file(path=sock_or_pair)
|
controller = Controller.from_socket_file(path=sock_or_pair)
|
||||||
else:
|
else:
|
||||||
if ':' in sock_or_pair:
|
if type(sock_or_pair) == int:
|
||||||
|
port = sock_or_pair
|
||||||
|
elif ':' in sock_or_pair:
|
||||||
port = sock_or_pair.split(':')[1]
|
port = sock_or_pair.split(':')[1]
|
||||||
else:
|
else:
|
||||||
port = sock_or_pair
|
port = sock_or_pair
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
import contextlib
|
import contextlib
|
||||||
|
import inspect
|
||||||
import json
|
import json
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
@ -162,7 +163,7 @@ def clean_booleans(oArgs):
|
|||||||
setattr(oArgs, key, False)
|
setattr(oArgs, key, False)
|
||||||
else:
|
else:
|
||||||
setattr(oArgs, key, True)
|
setattr(oArgs, key, True)
|
||||||
|
|
||||||
def on_log(iTox, level, filename, line, func, message, *data):
|
def on_log(iTox, level, filename, line, func, message, *data):
|
||||||
# LOG.debug(repr((level, filename, line, func, message,)))
|
# LOG.debug(repr((level, filename, line, func, message,)))
|
||||||
tox_log_cb(level, filename, line, func, message)
|
tox_log_cb(level, filename, line, func, message)
|
||||||
@ -210,7 +211,7 @@ def tox_log_cb(level, filename, line, func, message, *args):
|
|||||||
level = 30 # LOG.warn
|
level = 30 # LOG.warn
|
||||||
else:
|
else:
|
||||||
level = 20 # LOG.info
|
level = 20 # LOG.info
|
||||||
|
|
||||||
o = LOG.makeRecord(filename, level, func, line, message, list(), None)
|
o = LOG.makeRecord(filename, level, func, line, message, list(), None)
|
||||||
# LOG.handle(o)
|
# LOG.handle(o)
|
||||||
LOG_TRACE(f"{level}: {func}{line} {message}")
|
LOG_TRACE(f"{level}: {func}{line} {message}")
|
||||||
@ -251,7 +252,7 @@ def get_audio():
|
|||||||
with ignoreStderr():
|
with ignoreStderr():
|
||||||
import pyaudio
|
import pyaudio
|
||||||
oPyA = pyaudio.PyAudio()
|
oPyA = pyaudio.PyAudio()
|
||||||
|
|
||||||
input_devices = output_devices = 0
|
input_devices = output_devices = 0
|
||||||
for i in range(oPyA.get_device_count()):
|
for i in range(oPyA.get_device_count()):
|
||||||
device = oPyA.get_device_info_by_index(i)
|
device = oPyA.get_device_info_by_index(i)
|
||||||
@ -333,7 +334,7 @@ def vSetupLogging(oArgs):
|
|||||||
if add or sub:
|
if add or sub:
|
||||||
oArgs.logfile = oArgs.logfile[1:]
|
oArgs.logfile = oArgs.logfile[1:]
|
||||||
kwargs['filename'] = oArgs.logfile
|
kwargs['filename'] = oArgs.logfile
|
||||||
|
|
||||||
if coloredlogs:
|
if coloredlogs:
|
||||||
# https://pypi.org/project/coloredlogs/
|
# https://pypi.org/project/coloredlogs/
|
||||||
aKw = dict(level=oArgs.loglevel,
|
aKw = dict(level=oArgs.loglevel,
|
||||||
@ -350,7 +351,7 @@ def vSetupLogging(oArgs):
|
|||||||
if add:
|
if add:
|
||||||
oHandler = logging.StreamHandler(sys.stdout)
|
oHandler = logging.StreamHandler(sys.stdout)
|
||||||
LOG.addHandler(oHandler)
|
LOG.addHandler(oHandler)
|
||||||
|
|
||||||
LOG.info(f"Setting loglevel to {oArgs.loglevel!s}")
|
LOG.info(f"Setting loglevel to {oArgs.loglevel!s}")
|
||||||
|
|
||||||
|
|
||||||
@ -517,7 +518,7 @@ def generate_nodes_from_file(sFile,
|
|||||||
I had a conversation with @irungentoo on IRC about whether we really need to call tox_bootstrap() when having UDP disabled and why. The answer is yes, because in addition to TCP relays (tox_add_tcp_relay()), toxcore also needs to know addresses of UDP onion nodes in order to work correctly. The DHT, however, is not used when UDP is disabled. tox_bootstrap() function resolves the address passed to it as argument and calls onion_add_bs_node_path() and DHT_bootstrap() functions. Although calling DHT_bootstrap() is not really necessary as DHT is not used, we still need to resolve the address of the DHT node in order to populate the onion routes with onion_add_bs_node_path() call.
|
I had a conversation with @irungentoo on IRC about whether we really need to call tox_bootstrap() when having UDP disabled and why. The answer is yes, because in addition to TCP relays (tox_add_tcp_relay()), toxcore also needs to know addresses of UDP onion nodes in order to work correctly. The DHT, however, is not used when UDP is disabled. tox_bootstrap() function resolves the address passed to it as argument and calls onion_add_bs_node_path() and DHT_bootstrap() functions. Although calling DHT_bootstrap() is not really necessary as DHT is not used, we still need to resolve the address of the DHT node in order to populate the onion routes with onion_add_bs_node_path() call.
|
||||||
"""
|
"""
|
||||||
global aNODES_CACHE
|
global aNODES_CACHE
|
||||||
|
|
||||||
key = ipv
|
key = ipv
|
||||||
key += ',0' if udp_not_tcp else ',1'
|
key += ',0' if udp_not_tcp else ',1'
|
||||||
if key in aNODES_CACHE:
|
if key in aNODES_CACHE:
|
||||||
@ -642,7 +643,7 @@ def sDNSLookup(host):
|
|||||||
ipv = 6
|
ipv = 6
|
||||||
else:
|
else:
|
||||||
ipv = 4
|
ipv = 4
|
||||||
|
|
||||||
if ipv > 0:
|
if ipv > 0:
|
||||||
# LOG.debug(f"{ipv} IP address {host}")
|
# LOG.debug(f"{ipv} IP address {host}")
|
||||||
return host
|
return host
|
||||||
@ -652,10 +653,10 @@ def sDNSLookup(host):
|
|||||||
if False and stem:
|
if False and stem:
|
||||||
ip = sMapaddressResolv(host)
|
ip = sMapaddressResolv(host)
|
||||||
if ip: return ip
|
if ip: return ip
|
||||||
|
|
||||||
ip = sTorResolve(host)
|
ip = sTorResolve(host)
|
||||||
if ip: return ip
|
if ip: return ip
|
||||||
|
|
||||||
if not bHAVE_TORR:
|
if not bHAVE_TORR:
|
||||||
LOG.warn(f"onion address skipped because no tor-resolve {host}")
|
LOG.warn(f"onion address skipped because no tor-resolve {host}")
|
||||||
return ''
|
return ''
|
||||||
@ -680,7 +681,7 @@ def sDNSLookup(host):
|
|||||||
except:
|
except:
|
||||||
# drop through
|
# drop through
|
||||||
pass
|
pass
|
||||||
|
|
||||||
if ip == '':
|
if ip == '':
|
||||||
try:
|
try:
|
||||||
sout = f"/tmp/TR{os.getpid()}.log"
|
sout = f"/tmp/TR{os.getpid()}.log"
|
||||||
@ -701,7 +702,7 @@ def bootstrap_good(lelts, lToxes):
|
|||||||
|
|
||||||
def bootstrap_udp(lelts, lToxes):
|
def bootstrap_udp(lelts, lToxes):
|
||||||
lelts = lDNSClean(lelts)
|
lelts = lDNSClean(lelts)
|
||||||
LOG.debug(f'DHT bootstraping {len(lelts)}')
|
LOG.debug(f'DHT bootstraping {len(lelts)}')
|
||||||
for elt in lToxes:
|
for elt in lToxes:
|
||||||
random.shuffle(lelts)
|
random.shuffle(lelts)
|
||||||
for largs in lelts:
|
for largs in lelts:
|
||||||
@ -710,7 +711,7 @@ def bootstrap_udp(lelts, lToxes):
|
|||||||
if not ip:
|
if not ip:
|
||||||
LOG.warn(f'bootstrap_udp to {host} did not resolve')
|
LOG.warn(f'bootstrap_udp to {host} did not resolve')
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if type(port) == str:
|
if type(port) == str:
|
||||||
port = int(port)
|
port = int(port)
|
||||||
try:
|
try:
|
||||||
@ -765,7 +766,7 @@ def bootstrap_tcp(lelts, lToxes):
|
|||||||
else:
|
else:
|
||||||
LOG.debug(f'bootstrap_tcp to {host} but not connected')
|
LOG.debug(f'bootstrap_tcp to {host} but not connected')
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def iNmapInfoNmap(sProt, sHost, sPort, key=None, environ=None, cmd=''):
|
def iNmapInfoNmap(sProt, sHost, sPort, key=None, environ=None, cmd=''):
|
||||||
if sHost in ['-', 'NONE']: return 0
|
if sHost in ['-', 'NONE']: return 0
|
||||||
if not nmap: return 0
|
if not nmap: return 0
|
||||||
@ -784,7 +785,7 @@ def iNmapInfoNmap(sProt, sHost, sPort, key=None, environ=None, cmd=''):
|
|||||||
state = aScan[ip][prot][sPort]['state']
|
state = aScan[ip][prot][sPort]['state']
|
||||||
LOG.info(f"iNmapInfoNmap: to {sHost} {state}")
|
LOG.info(f"iNmapInfoNmap: to {sHost} {state}")
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
def iNmapInfo(sProt, sHost, sPort, key=None, environ=None, cmd='nmap'):
|
def iNmapInfo(sProt, sHost, sPort, key=None, environ=None, cmd='nmap'):
|
||||||
if sHost in ['-', 'NONE']: return 0
|
if sHost in ['-', 'NONE']: return 0
|
||||||
sFile = os.path.join("/tmp", f"{sHost}.{os.getpid()}.nmap")
|
sFile = os.path.join("/tmp", f"{sHost}.{os.getpid()}.nmap")
|
||||||
@ -811,7 +812,7 @@ def bootstrap_iNmapInfo(lElts, oArgs, protocol="tcp4", bIS_LOCAL=False, iNODES=i
|
|||||||
if not bIS_LOCAL and not bAreWeConnected():
|
if not bIS_LOCAL and not bAreWeConnected():
|
||||||
LOG.warn(f"bootstrap_iNmapInfo not local and NOT CONNECTED")
|
LOG.warn(f"bootstrap_iNmapInfo not local and NOT CONNECTED")
|
||||||
return True
|
return True
|
||||||
|
|
||||||
lRetval = []
|
lRetval = []
|
||||||
for elts in lElts[:iNODES]:
|
for elts in lElts[:iNODES]:
|
||||||
host, port, key = elts
|
host, port, key = elts
|
||||||
@ -842,7 +843,7 @@ def bootstrap_iNmapInfo(lElts, oArgs, protocol="tcp4", bIS_LOCAL=False, iNODES=i
|
|||||||
def caseFactory(cases):
|
def caseFactory(cases):
|
||||||
"""We want the tests run in order."""
|
"""We want the tests run in order."""
|
||||||
if len(cases) > 1:
|
if len(cases) > 1:
|
||||||
ordered_cases = sorted(cases, key=lambda f: findsource(f)[1])
|
ordered_cases = sorted(cases, key=lambda f: inspect.findsource(f)[1])
|
||||||
else:
|
else:
|
||||||
ordered_cases = cases
|
ordered_cases = cases
|
||||||
return ordered_cases
|
return ordered_cases
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
"""Originaly from https://github.com/oxij/PyTox c-toxcore-02 branch
|
"""Originaly from https://github.com/oxij/PyTox c-toxcore-02 branch
|
||||||
which itself was forked from https://github.com/aitjcize/PyTox/
|
which itself was forked from https://github.com/aitjcize/PyTox/
|
||||||
|
|
||||||
Modified to work with
|
Modified to work with
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import ctypes
|
import ctypes
|
||||||
@ -215,7 +215,7 @@ class ToxSuite(unittest.TestCase):
|
|||||||
self.bob.oArgs = opts
|
self.bob.oArgs = opts
|
||||||
if not bIS_LOCAL and not ts.bAreWeConnected():
|
if not bIS_LOCAL and not ts.bAreWeConnected():
|
||||||
LOG.warn(f"prepare not local and NOT CONNECTED")
|
LOG.warn(f"prepare not local and NOT CONNECTED")
|
||||||
|
|
||||||
self.lUdp = ts.generate_nodes(
|
self.lUdp = ts.generate_nodes(
|
||||||
oArgs=oTOX_OARGS,
|
oArgs=oTOX_OARGS,
|
||||||
nodes_count=8,
|
nodes_count=8,
|
||||||
@ -309,7 +309,7 @@ class ToxSuite(unittest.TestCase):
|
|||||||
"""
|
"""
|
||||||
i = 0
|
i = 0
|
||||||
bRet = None
|
bRet = None
|
||||||
|
|
||||||
self.bob.mycon_status = False
|
self.bob.mycon_status = False
|
||||||
def bobs_on_self_connection_status(iTox, connection_state, *args):
|
def bobs_on_self_connection_status(iTox, connection_state, *args):
|
||||||
status = connection_state
|
status = connection_state
|
||||||
@ -718,9 +718,9 @@ class ToxSuite(unittest.TestCase):
|
|||||||
o2 = self.bob.self_get_dht_id()
|
o2 = self.bob.self_get_dht_id()
|
||||||
assert len(o2) == 64
|
assert len(o2) == 64
|
||||||
|
|
||||||
if o1 != o2:
|
if o1 != o2:
|
||||||
LOG.warn(f"bootstrap_local DHT NOT same {o1} {o2} iStatus={iStatus}")
|
LOG.warn(f"bootstrap_local DHT NOT same {o1} {o2} iStatus={iStatus}")
|
||||||
|
|
||||||
iStatus = self.bob.self_get_connection_status()
|
iStatus = self.bob.self_get_connection_status()
|
||||||
if iStatus != TOX_CONNECTION['NONE']:
|
if iStatus != TOX_CONNECTION['NONE']:
|
||||||
LOG.info(f"bootstrap_local connected iStatus={iStatus}")
|
LOG.info(f"bootstrap_local connected iStatus={iStatus}")
|
||||||
@ -731,7 +731,7 @@ class ToxSuite(unittest.TestCase):
|
|||||||
return True
|
return True
|
||||||
LOG.warn(f"bootstrap_local NOT CONNECTED iStatus={iStatus}")
|
LOG.warn(f"bootstrap_local NOT CONNECTED iStatus={iStatus}")
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def test_bootstrap_iNmapInfo(self): # works
|
def test_bootstrap_iNmapInfo(self): # works
|
||||||
if oTOX_OARGS.network in ['new', 'newlocal', 'localnew']:
|
if oTOX_OARGS.network in ['new', 'newlocal', 'localnew']:
|
||||||
lElts = self.lUdp
|
lElts = self.lUdp
|
||||||
@ -741,7 +741,7 @@ class ToxSuite(unittest.TestCase):
|
|||||||
lElts = self.lUdp
|
lElts = self.lUdp
|
||||||
lRetval = []
|
lRetval = []
|
||||||
random.shuffle(lElts)
|
random.shuffle(lElts)
|
||||||
# assert
|
# assert
|
||||||
ts.bootstrap_iNmapInfo(lElts, oTOX_OARGS, bIS_LOCAL, iNODES=8)
|
ts.bootstrap_iNmapInfo(lElts, oTOX_OARGS, bIS_LOCAL, iNODES=8)
|
||||||
|
|
||||||
def test_self_get_secret_key(self): # works
|
def test_self_get_secret_key(self): # works
|
||||||
@ -927,7 +927,7 @@ class ToxSuite(unittest.TestCase):
|
|||||||
"""
|
"""
|
||||||
MSG = 'Happy'
|
MSG = 'Happy'
|
||||||
sSlot = 'friend_status_message'
|
sSlot = 'friend_status_message'
|
||||||
|
|
||||||
if oTOX_OARGS.bIS_LOCAL:
|
if oTOX_OARGS.bIS_LOCAL:
|
||||||
iRet = self.bob_add_alice_as_friend_norequest()
|
iRet = self.bob_add_alice_as_friend_norequest()
|
||||||
if iRet < 0:
|
if iRet < 0:
|
||||||
@ -1120,7 +1120,7 @@ class ToxSuite(unittest.TestCase):
|
|||||||
AID = self.baid
|
AID = self.baid
|
||||||
#: Test friend name
|
#: Test friend name
|
||||||
NEWNAME = 'Jenny'
|
NEWNAME = 'Jenny'
|
||||||
|
|
||||||
setattr(self.bob, sSlot, False)
|
setattr(self.bob, sSlot, False)
|
||||||
def bobs_on_friend_name(iTox, fid, newname, iNameSize, *largs):
|
def bobs_on_friend_name(iTox, fid, newname, iNameSize, *largs):
|
||||||
LOG_INFO(sSlot +" " +repr(fid))
|
LOG_INFO(sSlot +" " +repr(fid))
|
||||||
@ -1277,7 +1277,7 @@ class ToxSuite(unittest.TestCase):
|
|||||||
setattr(self.bob, sSlot, False)
|
setattr(self.bob, sSlot, False)
|
||||||
sSlot = 'friend_read_receipt'
|
sSlot = 'friend_read_receipt'
|
||||||
setattr(self.alice, sSlot, False)
|
setattr(self.alice, sSlot, False)
|
||||||
|
|
||||||
self.alice.callback_friend_read_receipt(alices_on_read_reciept) #was alices_on_friend_action
|
self.alice.callback_friend_read_receipt(alices_on_read_reciept) #was alices_on_friend_action
|
||||||
assert self.wait_ensure_exec(self.bob.friend_send_message,
|
assert self.wait_ensure_exec(self.bob.friend_send_message,
|
||||||
(self.baid,
|
(self.baid,
|
||||||
@ -1381,7 +1381,7 @@ class ToxSuite(unittest.TestCase):
|
|||||||
self.bob_add_alice_as_friend_norequest()
|
self.bob_add_alice_as_friend_norequest()
|
||||||
self.baid = self.bob.friend_by_public_key(self.alice._address)
|
self.baid = self.bob.friend_by_public_key(self.alice._address)
|
||||||
BID = self.baid
|
BID = self.baid
|
||||||
|
|
||||||
FRIEND_NUMBER = self.baid
|
FRIEND_NUMBER = self.baid
|
||||||
FILE_NUMBER = 1
|
FILE_NUMBER = 1
|
||||||
FILE = os.urandom(1024 * 1024)
|
FILE = os.urandom(1024 * 1024)
|
||||||
@ -1445,7 +1445,7 @@ class ToxSuite(unittest.TestCase):
|
|||||||
self.alice.completed = True
|
self.alice.completed = True
|
||||||
self.alice.file_control(fid, file_number, TOX_FILE_CONTROL['CANCEL'])
|
self.alice.file_control(fid, file_number, TOX_FILE_CONTROL['CANCEL'])
|
||||||
return
|
return
|
||||||
|
|
||||||
CONTEXT['FILE'] += data
|
CONTEXT['FILE'] += data
|
||||||
CONTEXT['RECEIVED'] += len(data)
|
CONTEXT['RECEIVED'] += len(data)
|
||||||
# if CONTEXT['RECEIVED'] < FILE_SIZE:
|
# if CONTEXT['RECEIVED'] < FILE_SIZE:
|
||||||
@ -1481,7 +1481,7 @@ class ToxSuite(unittest.TestCase):
|
|||||||
return
|
return
|
||||||
data = FILE[position:(position + length)]
|
data = FILE[position:(position + length)]
|
||||||
self.bob.file_send_chunk(fid, file_number, position, data)
|
self.bob.file_send_chunk(fid, file_number, position, data)
|
||||||
|
|
||||||
sSlot = 'file_recv_control'
|
sSlot = 'file_recv_control'
|
||||||
self.bob.callback_file_recv_control(bob_on_file_recv_control2)
|
self.bob.callback_file_recv_control(bob_on_file_recv_control2)
|
||||||
self.bob.callback_file_chunk_request(bob_on_file_chunk_request)
|
self.bob.callback_file_chunk_request(bob_on_file_chunk_request)
|
||||||
@ -1489,12 +1489,12 @@ class ToxSuite(unittest.TestCase):
|
|||||||
# was FILE_ID = FILE_NAME
|
# was FILE_ID = FILE_NAME
|
||||||
FILE_ID = 32*'1' #
|
FILE_ID = 32*'1' #
|
||||||
FILE_NAME = b'test.in'
|
FILE_NAME = b'test.in'
|
||||||
|
|
||||||
assert self.loop_until_connected()
|
assert self.loop_until_connected()
|
||||||
if not self.get_connection_status():
|
if not self.get_connection_status():
|
||||||
LOG.warn(f"test_file_transfer NOT CONNECTED")
|
LOG.warn(f"test_file_transfer NOT CONNECTED")
|
||||||
raise RuntimeError("not connected")
|
raise RuntimeError("not connected")
|
||||||
|
|
||||||
i = 0
|
i = 0
|
||||||
iKind = 0
|
iKind = 0
|
||||||
while i < 2:
|
while i < 2:
|
||||||
@ -1513,7 +1513,7 @@ class ToxSuite(unittest.TestCase):
|
|||||||
else:
|
else:
|
||||||
LOG.error(f"test_file_transfer bob.file_send 2")
|
LOG.error(f"test_file_transfer bob.file_send 2")
|
||||||
raise RuntimeError(f"test_file_transfer bob.file_send {THRESHOLD // 2}")
|
raise RuntimeError(f"test_file_transfer bob.file_send {THRESHOLD // 2}")
|
||||||
|
|
||||||
# UINT32_MAX
|
# UINT32_MAX
|
||||||
FID = self.bob.file_get_file_id(self.baid, FN)
|
FID = self.bob.file_get_file_id(self.baid, FN)
|
||||||
hexFID = "".join([hex(ord(c))[2:].zfill(2) for c in FILE_NAME])
|
hexFID = "".join([hex(ord(c))[2:].zfill(2) for c in FILE_NAME])
|
||||||
@ -1527,12 +1527,12 @@ class ToxSuite(unittest.TestCase):
|
|||||||
# ValueError: non-hexadecimal number found in fromhex() arg at position 0
|
# ValueError: non-hexadecimal number found in fromhex() arg at position 0
|
||||||
LOG_ERROR(f"test_file_transfer: {e}")
|
LOG_ERROR(f"test_file_transfer: {e}")
|
||||||
raise
|
raise
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
LOG_ERROR(f"test_file_transfer:: {e}")
|
LOG_ERROR(f"test_file_transfer:: {e}")
|
||||||
LOG_DEBUG('\n' + traceback.format_exc())
|
LOG_DEBUG('\n' + traceback.format_exc())
|
||||||
raise
|
raise
|
||||||
|
|
||||||
finally:
|
finally:
|
||||||
self.alice.callback_file_recv(None)
|
self.alice.callback_file_recv(None)
|
||||||
self.alice.callback_file_recv_control(None)
|
self.alice.callback_file_recv_control(None)
|
||||||
@ -1554,11 +1554,11 @@ class ToxSuite(unittest.TestCase):
|
|||||||
assert data is not None
|
assert data is not None
|
||||||
addr = self.alice.self_get_address()
|
addr = self.alice.self_get_address()
|
||||||
# self._address
|
# self._address
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self.alice.kill()
|
self.alice.kill()
|
||||||
except: pass
|
except: pass
|
||||||
|
|
||||||
oArgs = oTOX_OARGS
|
oArgs = oTOX_OARGS
|
||||||
opts = oToxygenToxOptions(oArgs)
|
opts = oToxygenToxOptions(oArgs)
|
||||||
opts.savedata_data = data
|
opts.savedata_data = data
|
||||||
@ -1570,11 +1570,11 @@ class ToxSuite(unittest.TestCase):
|
|||||||
f"{addr} != {self.alice.self_get_address()}")
|
f"{addr} != {self.alice.self_get_address()}")
|
||||||
else:
|
else:
|
||||||
LOG.info("passed test_tox_savedata")
|
LOG.info("passed test_tox_savedata")
|
||||||
|
|
||||||
def vOargsToxPreamble(oArgs, Tox, ToxTest):
|
def vOargsToxPreamble(oArgs, Tox, ToxTest):
|
||||||
|
|
||||||
ts.vSetupLogging()
|
ts.vSetupLogging()
|
||||||
|
|
||||||
methods = set([x for x in dir(Tox) if not x[0].isupper()
|
methods = set([x for x in dir(Tox) if not x[0].isupper()
|
||||||
and not x[0] == '_'])
|
and not x[0] == '_'])
|
||||||
docs = "".join([getattr(ToxTest, x).__doc__ for x in dir(ToxTest)
|
docs = "".join([getattr(ToxTest, x).__doc__ for x in dir(ToxTest)
|
||||||
|
Loading…
Reference in New Issue
Block a user