Refactored tests
This commit is contained in:
parent
ad59434927
commit
1aa831cbd6
@ -1,80 +0,0 @@
|
|||||||
tox_version_major
|
|
||||||
tox_version_minor
|
|
||||||
tox_version_patch
|
|
||||||
tox_version_is_compatible
|
|
||||||
tox_public_key_size
|
|
||||||
tox_secret_key_size
|
|
||||||
tox_conference_uid_size
|
|
||||||
tox_conference_id_size
|
|
||||||
tox_nospam_size
|
|
||||||
tox_address_size
|
|
||||||
tox_max_name_length
|
|
||||||
tox_max_status_message_length
|
|
||||||
tox_max_friend_request_length
|
|
||||||
tox_max_message_length
|
|
||||||
tox_max_custom_packet_size
|
|
||||||
tox_hash_length
|
|
||||||
tox_file_id_length
|
|
||||||
tox_max_filename_length
|
|
||||||
tox_max_hostname_length
|
|
||||||
tox_options_get_ipv6_enabled
|
|
||||||
tox_options_get_udp_enabled
|
|
||||||
tox_options_get_local_discovery_enabled
|
|
||||||
tox_options_get_dht_announcements_enabled
|
|
||||||
tox_options_get_proxy_type
|
|
||||||
tox_options_get_proxy_port
|
|
||||||
tox_options_get_start_port
|
|
||||||
tox_options_get_end_port
|
|
||||||
tox_options_get_tcp_port
|
|
||||||
tox_options_get_hole_punching_enabled
|
|
||||||
tox_options_get_savedata_type
|
|
||||||
tox_options_get_savedata_length
|
|
||||||
tox_options_get_experimental_thread_safety
|
|
||||||
tox_file_seek
|
|
||||||
tox_callback_conference_connected
|
|
||||||
tox_callback_conference_message
|
|
||||||
tox_callback_conference_title
|
|
||||||
tox_callback_conference_peer_list_changed
|
|
||||||
tox_conference_new
|
|
||||||
tox_conference_delete
|
|
||||||
tox_conference_peer_count
|
|
||||||
tox_conference_peer_get_name_size
|
|
||||||
tox_conference_peer_get_name
|
|
||||||
tox_conference_peer_get_public_key
|
|
||||||
tox_conference_peer_number_is_ours
|
|
||||||
tox_conference_offline_peer_count
|
|
||||||
tox_conference_offline_peer_get_name_size
|
|
||||||
tox_conference_offline_peer_get_name
|
|
||||||
tox_conference_offline_peer_get_public_key
|
|
||||||
tox_conference_offline_peer_get_last_active
|
|
||||||
tox_conference_set_max_offline
|
|
||||||
tox_conference_invite
|
|
||||||
tox_conference_join
|
|
||||||
tox_conference_send_message
|
|
||||||
tox_conference_get_title_size
|
|
||||||
tox_conference_get_title
|
|
||||||
tox_conference_set_title
|
|
||||||
tox_conference_get_chatlist_size
|
|
||||||
tox_conference_get_chatlist
|
|
||||||
tox_conference_get_type
|
|
||||||
tox_conference_get_id
|
|
||||||
tox_conference_by_id
|
|
||||||
tox_conference_get_uid
|
|
||||||
tox_conference_by_uid
|
|
||||||
tox_group_max_topic_length
|
|
||||||
tox_group_max_part_length
|
|
||||||
tox_group_max_group_name_length
|
|
||||||
tox_group_max_password_size
|
|
||||||
tox_group_chat_id_size
|
|
||||||
tox_group_peer_public_key_size
|
|
||||||
tox_group_peer_get_connection_status
|
|
||||||
tox_group_get_voice_state
|
|
||||||
tox_callback_group_voice_state
|
|
||||||
tox_group_get_topic_lock
|
|
||||||
tox_callback_group_topic_lock
|
|
||||||
tox_group_send_custom_private_packet
|
|
||||||
tox_callback_group_custom_private_packet
|
|
||||||
tox_group_founder_set_topic_lock
|
|
||||||
tox_group_founder_set_voice_state
|
|
||||||
tox_group_set_ignore
|
|
||||||
tox_group_mod_kick_peer
|
|
@ -175,7 +175,7 @@ class Tox:
|
|||||||
|
|
||||||
def kill(self):
|
def kill(self):
|
||||||
if hasattr(self, 'AV'): del self.AV
|
if hasattr(self, 'AV'): del self.AV
|
||||||
LOG_DEBUG(f"tox_kill")
|
LOG_INFO(f"tox_kill")
|
||||||
try:
|
try:
|
||||||
Tox.libtoxcore.tox_kill(self._tox_pointer)
|
Tox.libtoxcore.tox_kill(self._tox_pointer)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
@ -305,7 +305,7 @@ class Tox:
|
|||||||
raise ArgumentError('One of the arguments to the function was NULL when it was not expected.')
|
raise ArgumentError('One of the arguments to the function was NULL when it was not expected.')
|
||||||
if tox_err_bootstrap == TOX_ERR_BOOTSTRAP['BAD_HOST']:
|
if tox_err_bootstrap == TOX_ERR_BOOTSTRAP['BAD_HOST']:
|
||||||
raise ArgumentError('The address could not be resolved to an IP '
|
raise ArgumentError('The address could not be resolved to an IP '
|
||||||
'address, or the IP address passed was invalid.')
|
'address, or the address passed was invalid.')
|
||||||
if tox_err_bootstrap == TOX_ERR_BOOTSTRAP['BAD_PORT']:
|
if tox_err_bootstrap == TOX_ERR_BOOTSTRAP['BAD_PORT']:
|
||||||
raise ArgumentError('The port passed was invalid. The valid port range is (1, 65535).')
|
raise ArgumentError('The port passed was invalid. The valid port range is (1, 65535).')
|
||||||
# me - this seems wrong - should be False
|
# me - this seems wrong - should be False
|
||||||
@ -763,7 +763,8 @@ class Tox:
|
|||||||
"""
|
"""
|
||||||
Checks if a friend with the given friend number exists and returns true if it does.
|
Checks if a friend with the given friend number exists and returns true if it does.
|
||||||
"""
|
"""
|
||||||
return bool(Tox.libtoxcore.tox_friend_exists(self._tox_pointer, c_uint32(friend_number)))
|
# bool() -> TypeError: 'str' object cannot be interpreted as an integer
|
||||||
|
return Tox.libtoxcore.tox_friend_exists(self._tox_pointer, c_uint32(friend_number))
|
||||||
|
|
||||||
def self_get_friend_list_size(self):
|
def self_get_friend_list_size(self):
|
||||||
"""
|
"""
|
||||||
@ -1154,24 +1155,28 @@ class Tox:
|
|||||||
raise ToxError('The function did not return OK for set typing.')
|
raise ToxError('The function did not return OK for set typing.')
|
||||||
|
|
||||||
def friend_send_message(self, friend_number, message_type, message):
|
def friend_send_message(self, friend_number, message_type, message):
|
||||||
"""
|
"""Send a text chat message to an online friend.
|
||||||
Send a text chat message to an online friend.
|
|
||||||
|
|
||||||
This function creates a chat message packet and pushes it into the send queue.
|
This function creates a chat message packet and pushes it into the send queue.
|
||||||
|
|
||||||
The message length may not exceed TOX_MAX_MESSAGE_LENGTH. Larger messages must be split by the client and sent
|
The message length may not exceed
|
||||||
as separate messages. Other clients can then reassemble the fragments. Messages may not be empty.
|
TOX_MAX_MESSAGE_LENGTH. Larger messages must be split by the
|
||||||
|
client and sent as separate messages. Other clients can then
|
||||||
|
reassemble the fragments. Messages may not be empty.
|
||||||
|
|
||||||
The return value of this function is the message ID. If a read receipt is received, the triggered
|
The return value of this function is the message ID. If a read
|
||||||
`friend_read_receipt` event will be passed this message ID.
|
receipt is received, the triggered `friend_read_receipt` event
|
||||||
|
will be passed this message ID.
|
||||||
|
|
||||||
Message IDs are unique per friend. The first message ID is 0. Message IDs are incremented by 1 each time a
|
Message IDs are unique per friend. The first message ID is 0.
|
||||||
message is sent. If UINT32_MAX messages were sent, the next message ID is 0.
|
Message IDs are incremented by 1 each time a message is sent.
|
||||||
|
If UINT32_MAX messages were sent, the next message ID is 0.
|
||||||
|
|
||||||
:param friend_number: The friend number of the friend to send the message to.
|
:param friend_number: The friend number of the friend to send the message to.
|
||||||
:param message_type: Message type (TOX_MESSAGE_TYPE).
|
:param message_type: Message type (TOX_MESSAGE_TYPE).
|
||||||
:param message: A non-None message text.
|
:param message: A non-None message text.
|
||||||
:return: message ID
|
:return: message ID
|
||||||
|
|
||||||
"""
|
"""
|
||||||
tox_err_friend_send_message = c_int()
|
tox_err_friend_send_message = c_int()
|
||||||
LOG_DEBUG(f"tox_friend_send_message")
|
LOG_DEBUG(f"tox_friend_send_message")
|
||||||
@ -1938,8 +1943,8 @@ class Tox:
|
|||||||
|
|
||||||
byref(error))
|
byref(error))
|
||||||
if error.value:
|
if error.value:
|
||||||
LOG_ERROR(f"group_join {error.value}")
|
LOG_ERROR(f"group_join {error.value} {TOX_ERR_GROUP_JOIN[error.value]}")
|
||||||
raise ToxError(f"group_join {error.value}")
|
raise ToxError(f"group_join {error.value} {TOX_ERR_GROUP_JOIN[error.value]}")
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def group_reconnect(self, group_number):
|
def group_reconnect(self, group_number):
|
||||||
@ -2438,12 +2443,12 @@ class Tox:
|
|||||||
|
|
||||||
def groups_get_list(self):
|
def groups_get_list(self):
|
||||||
raise NotImplementedError('tox_groups_get_list')
|
raise NotImplementedError('tox_groups_get_list')
|
||||||
groups_list_size = self.group_get_number_groups()
|
# groups_list_size = self.group_get_number_groups()
|
||||||
groups_list = create_string_buffer(sizeof(c_uint32) * groups_list_size)
|
# groups_list = create_string_buffer(sizeof(c_uint32) * groups_list_size)
|
||||||
groups_list = POINTER(c_uint32)(groups_list)
|
# groups_list = POINTER(c_uint32)(groups_list)
|
||||||
LOG_DEBUG(f"tox_groups_get_list")
|
# LOG_DEBUG(f"tox_groups_get_list")
|
||||||
Tox.libtoxcore.tox_groups_get_list(self._tox_pointer, groups_list)
|
# Tox.libtoxcore.tox_groups_get_list(self._tox_pointer, groups_list)
|
||||||
return groups_list[0:groups_list_size]
|
# return groups_list[0:groups_list_size]
|
||||||
|
|
||||||
def group_get_privacy_state(self, group_number):
|
def group_get_privacy_state(self, group_number):
|
||||||
"""
|
"""
|
||||||
@ -3105,6 +3110,9 @@ class Tox:
|
|||||||
LOG_DEBUG(f"tox_callback_group_moderation")
|
LOG_DEBUG(f"tox_callback_group_moderation")
|
||||||
|
|
||||||
def group_toggle_set_ignore(self, group_number, peer_id, ignore):
|
def group_toggle_set_ignore(self, group_number, peer_id, ignore):
|
||||||
|
return group_set_ignore(self, group_number, peer_id, ignore)
|
||||||
|
|
||||||
|
def group_set_ignore(self, group_number, peer_id, ignore):
|
||||||
"""
|
"""
|
||||||
Ignore or unignore a peer.
|
Ignore or unignore a peer.
|
||||||
|
|
||||||
@ -3116,10 +3124,9 @@ class Tox:
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
error = c_int()
|
error = c_int()
|
||||||
LOG_DEBUG(f"tox_group_toggle_set_ignore")
|
LOG_DEBUG(f"tox_group_set_ignore")
|
||||||
result = Tox.libtoxcore.tox_group_toggle_set_ignore(self._tox_pointer, group_number, peer_id, ignore, byref(error))
|
result = Tox.libtoxcore.tox_group_set_ignore(self._tox_pointer, group_number, peer_id, ignore, byref(error))
|
||||||
if error.value:
|
if error.value:
|
||||||
LOG_ERROR(f"tox_group_toggle_set_ignore {error.value}")
|
LOG_ERROR(f"tox_group_set_ignore {error.value}")
|
||||||
raise ToxError("tox_group_toggle_set_ignore {error.value}")
|
raise ToxError("tox_group_set_ignore {error.value}")
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
@ -29,22 +29,177 @@ LOG = logging.getLogger()
|
|||||||
|
|
||||||
bHAVE_TORR = shutil.which('tor-resolve')
|
bHAVE_TORR = shutil.which('tor-resolve')
|
||||||
|
|
||||||
|
yKNOWN_ONIONS = """
|
||||||
|
- facebookwkhpilnemxj7asaniu7vnjjbiltxjqhye3mhbshg7kx5tfyd # facebook
|
||||||
|
- duckduckgogg42xjoc72x3sjasowoarfbgcmvfimaftt6twagswzczad # ddg
|
||||||
|
- zkaan2xfbuxia2wpf7ofnkbz6r5zdbbvxbunvp5g2iebopbfc4iqmbad # hks
|
||||||
|
"""
|
||||||
|
# grep -B 1 '<li><a href="' /tmp/tor.html |sed -e 's/<li><a href="http:../ - /' -e 's/.onion.*//' -e 's/<li id=./ # /' -e 's/".*//' -e '/^--/d' -e '/<li id/d'
|
||||||
|
# This will slow things down 1-2 min each
|
||||||
|
yKNOWN_ONIONS_TOR = """
|
||||||
|
# 2019.www.torproject.org
|
||||||
|
- jqyzxhjk6psc6ul5jnfwloamhtyh7si74b4743k2qgpskwwxrzhsxmad
|
||||||
|
# api.donate.torproject.org
|
||||||
|
- rbi3fpvpz4vlrx67scoqef2zxz7k4xyiludszg655favvkygjmhz6wyd
|
||||||
|
# archive.torproject.org
|
||||||
|
- uy3qxvwzwoeztnellvvhxh7ju7kfvlsauka7avilcjg7domzxptbq7qd
|
||||||
|
# aus1.torproject.org
|
||||||
|
- ot3ivcdxmalbsbponeeq5222hftpf3pqil24q3s5ejwo5t52l65qusid
|
||||||
|
# aus2.torproject.org
|
||||||
|
- b5t7emfr2rn3ixr4lvizpi3stnni4j4p6goxho7lldf4qg4hz5hvpqid
|
||||||
|
# blog.torproject.org
|
||||||
|
- pzhdfe7jraknpj2qgu5cz2u3i4deuyfwmonvzu5i3nyw4t4bmg7o5pad
|
||||||
|
# bridges.torproject.org
|
||||||
|
- yq5jjvr7drkjrelzhut7kgclfuro65jjlivyzfmxiq2kyv5lickrl4qd
|
||||||
|
# cloud.torproject.org
|
||||||
|
- ui3cpcohcoko6aydhuhlkwqqtvadhaflcc5zb7mwandqmcal7sbwzwqd
|
||||||
|
# collector.torproject.org
|
||||||
|
- pgmrispjerzzf2tdzbfp624cg5vpbvdw2q5a3hvtsbsx25vnni767yad
|
||||||
|
# collector2.torproject.org
|
||||||
|
- 3srlmjzbyyzz62jvdfqwn5ldqmh6mwnqxre2zamxveb75uz2qrqkrkyd
|
||||||
|
# community.torproject.org
|
||||||
|
- xmrhfasfg5suueegrnc4gsgyi2tyclcy5oz7f5drnrodmdtob6t2ioyd
|
||||||
|
# consensus-health.torproject.org
|
||||||
|
- tkskz5dkjel4xqyw5d5l3k52kgglotwn6vgb5wrl2oa5yi2szvywiyid
|
||||||
|
# crm.torproject.org
|
||||||
|
- 6ojylpznauimd2fga3m7g24vd7ebkzlemxdprxckevqpzs347ugmynqd
|
||||||
|
# deb.torproject.org
|
||||||
|
- apow7mjfryruh65chtdydfmqfpj5btws7nbocgtaovhvezgccyjazpqd
|
||||||
|
# dev.crm.torproject.org
|
||||||
|
- eewp4iydzyu2a5d6bvqadadkozxdbhsdtmsoczu2joexfrjjsheaecad
|
||||||
|
# dist.torproject.org
|
||||||
|
- scpalcwstkydpa3y7dbpkjs2dtr7zvtvdbyj3dqwkucfrwyixcl5ptqd
|
||||||
|
# donate-api.torproject.org
|
||||||
|
- lkfkuhcx62yfvzuz5o3ju4divuf4bsh2bybwd3oierq47kyp2ig2gvid
|
||||||
|
# donate.torproject.org
|
||||||
|
- yoaenchicimox2qdc47p36zm3cuclq7s7qxx6kvxqaxjodigfifljqqd
|
||||||
|
# exonerator.torproject.org
|
||||||
|
- pm46i5h2lfewyx6l7pnicbxhts2sxzacvsbmqiemqaspredf2gm3dpad
|
||||||
|
# extra.torproject.org
|
||||||
|
- kkr72iohlfix5ipjg776eyhplnl2oiv5tz4h2y2bkhjix3quafvjd5ad
|
||||||
|
# gettor.torproject.org
|
||||||
|
- ueghr2hzndecdntou33mhymbbxj7pir74nwzhqr6drhxpbz3j272p4id
|
||||||
|
# git.torproject.org
|
||||||
|
- xtlfhaspqtkeeqxk6umggfbr3gyfznvf4jhrge2fujz53433i2fcs3id
|
||||||
|
# gitlab.torproject.org
|
||||||
|
- eweiibe6tdjsdprb4px6rqrzzcsi22m4koia44kc5pcjr7nec2rlxyad
|
||||||
|
# gitweb.torproject.org
|
||||||
|
- gzgme7ov25seqjbphab4fkcph3jkobfwwpivt5kzbv3kqx2y2qttl4yd
|
||||||
|
# grafana1.torproject.org
|
||||||
|
- 7zjnw5lx2x27rwiocxkqdquo7fawj46mf2wiu2l7e6z6ng6nivmdxnad
|
||||||
|
# grafana2.torproject.org
|
||||||
|
- f3vd6fyiccuppybkxiblgigej3pfvvqzjnhd3wyv7h4ee5asawf2fhqd
|
||||||
|
# ircbouncer.torproject.org
|
||||||
|
- moz5kotsnjony4oxccxfo4lwk3pvoxmdoljibhgoonzgzjs5oemtjmqd
|
||||||
|
# metabase.metrics.torproject.org
|
||||||
|
- gr5pseamigereei4c6654hafzhid5z2c3oqzn6cfnx7yfyelt47znhad
|
||||||
|
# metrics.torproject.org
|
||||||
|
- hctxrvjzfpvmzh2jllqhgvvkoepxb4kfzdjm6h7egcwlumggtktiftid
|
||||||
|
# moat.torproject.org
|
||||||
|
- z7m7ogzdhu43nosvjtsuplfmuqa3ge5obahixydhmzdox6owwxfoxzid
|
||||||
|
# nagios.torproject.org
|
||||||
|
- w6vizvw4ckesva5fvlkrepynemxdq6pgo5sh4r76ec6msq5notkhqryd
|
||||||
|
# newsletter.torproject.org
|
||||||
|
- a4ygisnerpgtc5ayerl22pll6cls3oyj54qgpm7qrmb66xrxts6y3lyd
|
||||||
|
# nightlies.tbb.torproject.org
|
||||||
|
- umj4zbqdfcyevlkgqgpq6foxk3z75zzxsbgt5jqmfxofrbrjh3crbnad
|
||||||
|
# nyx.torproject.org
|
||||||
|
- 3ewfgrt4gzfccp6bnquhqb266r3zepiqpnsk3falwygkegtluwuyevid
|
||||||
|
- xao2lxsmia2edq2n5zxg6uahx6xox2t7bfjw6b5vdzsxi7ezmqob6qid
|
||||||
|
- dud2sxm6feahhuwj4y4lzktduy7v3qpaqsfkggtj2ojmzathttkegoid
|
||||||
|
# openpgpkey.torproject.org
|
||||||
|
- 2yldcptk56shc7lwieozoglw3t5ghty7m6mf2faysvfnzccqavbu2mad
|
||||||
|
# people.torproject.org
|
||||||
|
- 5ecey6oe4rocdsfoigr4idu42cecm2j7zfogc3xc7kfn4uriehwrs6qd
|
||||||
|
# prometheus1.torproject.org
|
||||||
|
- ydok5jiruh3ak6hcfdlm2g7iuraaxcomeckj2nucjsxif6qmrrda2byd
|
||||||
|
# prometheus2.torproject.org
|
||||||
|
- vyo6yrqhl3by7d6n5t6hjkflaqbarjpqjnvapr5u5rafk4imnfrmcjyd
|
||||||
|
# rbm.torproject.org
|
||||||
|
- nkuz2tpok7ctwd5ueer5bytj3bm42vp7lgjcsnznal3stotg6vyaakyd
|
||||||
|
# research.torproject.org
|
||||||
|
- xhqthou6scpfnwjyzc3ekdgcbvj76ccgyjyxp6cgypxjlcuhnxiktnqd
|
||||||
|
# review.torproject.net
|
||||||
|
- zhkhhhnppc5k6xju7n25rjba3wuip73jnodicxl65qdpchrwvvsilcyd
|
||||||
|
# rpm.torproject.org
|
||||||
|
- 4ayyzfoh5qdrokqaejis3rdredhvf22n3migyxfudpkpunngfc7g4lqd
|
||||||
|
# snowflake.torproject.org
|
||||||
|
- oljlphash3bpqtrvqpr5gwzrhroziw4mddidi5d2qa4qjejcbrmoypqd
|
||||||
|
# spec.torproject.org
|
||||||
|
- i3xi5qxvbrngh3g6o7czwjfxwjzigook7zxzjmgwg5b7xnjcn5hzciad
|
||||||
|
# staging-api.donate.torproject.org
|
||||||
|
- vorwws6g6mx23djlznmlqva4t5olulpnet6fxyiyytcu5dorp3fstdqd
|
||||||
|
# staging.crm.torproject.org
|
||||||
|
- pt34uujusar4arrvsqljndqlt7tck2d5cosaav5xni4nh7bmvshyp2yd
|
||||||
|
# staging.donate-api.torproject.org
|
||||||
|
- 7niqsyixinnhxvh33zh5dqnplxnc2yd6ktvats3zmtbbpzcphpbsa6qd
|
||||||
|
# status.torproject.org
|
||||||
|
- eixoaclv7qvnmu5rolbdwba65xpdiditdoyp6edsre3fitad777jr3ad
|
||||||
|
# stem.torproject.org
|
||||||
|
- mf34jlghauz5pxjcmdymdqbe5pva4v24logeys446tdrgd5lpsrocmqd
|
||||||
|
# styleguide.torproject.org
|
||||||
|
- 7khzpw47s35pwo3lvtctwf2szvnq3kgglvzc22elx7of2awdzpovqmqd
|
||||||
|
# submission.torproject.org
|
||||||
|
- givpjczyrb5jjseful3o5tn3tg7tidbu4gydl4sa5ekpcipivqaqnpad
|
||||||
|
# support.torproject.org
|
||||||
|
- rzuwtpc4wb3xdzrj3yeajsvm3fkq4vbeubm2tdxaqruzzzgs5dwemlad
|
||||||
|
# survey.torproject.org
|
||||||
|
- eh5esdnd6fkbkapfc6nuyvkjgbtnzq2is72lmpwbdbxepd2z7zbgzsqd
|
||||||
|
# svn-archive.torproject.org
|
||||||
|
- b63iq6es4biaawfilwftlfkw6a6putogxh4iakei2ioppb7dsfucekyd
|
||||||
|
# tb-manual.torproject.org
|
||||||
|
- dsbqrprgkqqifztta6h3w7i2htjhnq7d3qkh3c7gvc35e66rrcv66did
|
||||||
|
# test-api.donate.torproject.org
|
||||||
|
- wiofesr5qt2k7qrlljpk53isgedxi6ddw6z3o7iay2l7ne3ziyagxaid
|
||||||
|
# test-data.tbb.torproject.org
|
||||||
|
- umbk3kbgov4ekg264yulvbrpykfye7ohguqbds53qn547mdpt6o4qkad
|
||||||
|
# test.crm.torproject.org
|
||||||
|
- a4d52y2erv4eijii66cpnyqn7rsnnq3gmtrsdxzt2laoutvu4gz7fwid
|
||||||
|
# test.donate-api.torproject.org
|
||||||
|
- i4zhrn4md3ucd5dfgeo5lnqd3jy2z2kzp3lt4tdisvivzoqqtlrymkid
|
||||||
|
# www
|
||||||
|
- tttyx2vwp7ihml3vkhywwcizv6nbwrikpgeciy3qrow7l7muak2pnhad
|
||||||
|
# www.torproject.org
|
||||||
|
- 2gzyxa5ihm7nsggfxnu52rck2vv4rvmdlkiu3zzui5du4xyclen53wid
|
||||||
|
"""
|
||||||
|
|
||||||
# we check these each time but we got them by sorting bad relays
|
# we check these each time but we got them by sorting bad relays
|
||||||
# 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
|
||||||
|
- a9.wtf
|
||||||
|
- apt96.com
|
||||||
|
- axims.net
|
||||||
|
- backup.spekadyon.org
|
||||||
|
- dfri.se
|
||||||
|
- dotsrc.org
|
||||||
|
- dtf.contact
|
||||||
|
- ezyn.de
|
||||||
|
- for-privacy.net
|
||||||
|
- galtland.network
|
||||||
- heraldonion.org
|
- heraldonion.org
|
||||||
|
- interfesse.net
|
||||||
|
- kryptonit.org
|
||||||
- linkspartei.org
|
- linkspartei.org
|
||||||
|
- mkg20001.io
|
||||||
|
- nicdex.com
|
||||||
|
- nx42.de
|
||||||
- pineapple.cx
|
- pineapple.cx
|
||||||
|
- privacylayer.xyz
|
||||||
|
- privacysvcs.net
|
||||||
|
- prsv.ch
|
||||||
|
- sebastian-elisa-pfeifer.eu
|
||||||
- thingtohide.nl
|
- thingtohide.nl
|
||||||
- tor-exit-2.aa78i2efsewr0neeknk.xyz
|
- tor-exit-2.aa78i2efsewr0neeknk.xyz
|
||||||
- tor-exit-3.aa78i2efsewr0neeknk.xyz
|
- tor-exit-3.aa78i2efsewr0neeknk.xyz
|
||||||
- tor.dlecan.com
|
- tor.dlecan.com
|
||||||
|
- tor.skankhunt42.pw
|
||||||
|
- transliberation.today
|
||||||
- tuxli.org
|
- tuxli.org
|
||||||
|
- unzane.com
|
||||||
- verification-for-nusenu.net
|
- verification-for-nusenu.net
|
||||||
|
- www.defcon.org
|
||||||
"""
|
"""
|
||||||
# - 0x0.is
|
|
||||||
# - a9.wtf
|
|
||||||
# - aklad5.com
|
# - aklad5.com
|
||||||
# - artikel5ev.de
|
# - artikel5ev.de
|
||||||
# - arvanode.net
|
# - arvanode.net
|
||||||
@ -218,7 +373,8 @@ def lIntroductionPoints(controller=None, lOnions=[], itimeout=120, log_level=10)
|
|||||||
l += lp
|
l += lp
|
||||||
except (Empty, Timeout,) as e: # noqa
|
except (Empty, Timeout,) as e: # noqa
|
||||||
LOG.warn(f"Timed out getting introduction points for {elt}")
|
LOG.warn(f"Timed out getting introduction points for {elt}")
|
||||||
continue
|
except stem.DescriptorUnavailable as e:
|
||||||
|
LOG.error(e)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
LOG.exception(e)
|
LOG.exception(e)
|
||||||
return l
|
return l
|
||||||
|
@ -16,6 +16,7 @@ import traceback
|
|||||||
import unittest
|
import unittest
|
||||||
from ctypes import *
|
from ctypes import *
|
||||||
from random import Random
|
from random import Random
|
||||||
|
import functools
|
||||||
|
|
||||||
random = Random()
|
random = Random()
|
||||||
|
|
||||||
@ -108,16 +109,28 @@ bHAVE_BASH = shutil.which('bash')
|
|||||||
bHAVE_TORR = shutil.which('tor-resolve')
|
bHAVE_TORR = shutil.which('tor-resolve')
|
||||||
|
|
||||||
lDEAD_BS = [
|
lDEAD_BS = [
|
||||||
# [notice] Have tried resolving or connecting to address
|
# Failed to resolve "tox3.plastiras.org"
|
||||||
# at 3 different places. Giving up.
|
|
||||||
'104.244.74.69',
|
|
||||||
'172.93.52.70',
|
|
||||||
'tox.abilinski.com',
|
|
||||||
'tox.novg.net',
|
|
||||||
# Failed to resolve "tox3.plastiras.org".
|
|
||||||
"tox3.plastiras.org",
|
"tox3.plastiras.org",
|
||||||
|
'tox.kolka.tech',
|
||||||
|
# IPs that do not reverse resolve
|
||||||
|
'49.12.229.145',
|
||||||
|
"46.101.197.175",
|
||||||
|
'114.35.245.150',
|
||||||
|
'172.93.52.70',
|
||||||
|
'195.123.208.139',
|
||||||
|
'205.185.115.131',
|
||||||
|
# IPs that do not rreverse resolve
|
||||||
|
'yggnode.cf', '188.225.9.167',
|
||||||
|
'85-143-221-42.simplecloud.ru', '85.143.221.42',
|
||||||
|
# IPs that do not ping
|
||||||
|
'104.244.74.69', 'tox.plastiras.org',
|
||||||
|
'195.123.208.139',
|
||||||
|
'gt.sot-te.ch', '32.226.5.82',
|
||||||
|
# suspicious IPs
|
||||||
|
'tox.abilinski.com', '172.103.164.250', '172.103.164.250.tpia.cipherkey.com',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
def assert_main_thread():
|
def assert_main_thread():
|
||||||
from PyQt5 import QtCore, QtWidgets
|
from PyQt5 import QtCore, QtWidgets
|
||||||
from qtpy.QtWidgets import QApplication
|
from qtpy.QtWidgets import QApplication
|
||||||
@ -266,7 +279,7 @@ def get_audio():
|
|||||||
'enabled': input_devices and output_devices}
|
'enabled': input_devices and output_devices}
|
||||||
return audio
|
return audio
|
||||||
|
|
||||||
def oMainArgparser(_=None, iMode=2):
|
def oMainArgparser(_=None, iMode=0):
|
||||||
# 'Mode: 0=chat 1=chat+audio 2=chat+audio+video default: 0'
|
# 'Mode: 0=chat 1=chat+audio 2=chat+audio+video default: 0'
|
||||||
if not os.path.exists('/proc/sys/net/ipv6'):
|
if not os.path.exists('/proc/sys/net/ipv6'):
|
||||||
bIpV6 = 'False'
|
bIpV6 = 'False'
|
||||||
@ -274,15 +287,24 @@ def oMainArgparser(_=None, iMode=2):
|
|||||||
bIpV6 = 'True'
|
bIpV6 = 'True'
|
||||||
lIpV6Choices=[bIpV6, 'False']
|
lIpV6Choices=[bIpV6, 'False']
|
||||||
|
|
||||||
|
sNodesJson = os.path.join(os.environ['HOME'], '.config', 'tox', 'DHTnodes.json')
|
||||||
|
if not os.path.exists(sNodesJson): sNodesJson = ''
|
||||||
|
|
||||||
|
logfile = os.path.join(os.environ.get('TMPDIR', '/tmp'), 'toxygen.log')
|
||||||
|
if not os.path.exists(sNodesJson): logfile = ''
|
||||||
|
|
||||||
parser = argparse.ArgumentParser(add_help=True)
|
parser = argparse.ArgumentParser(add_help=True)
|
||||||
parser.add_argument('--proxy_host', '--proxy-host', type=str,
|
parser.add_argument('--proxy_host', '--proxy-host', type=str,
|
||||||
default='',
|
# oddball - we want to use '' as a setting
|
||||||
|
default='0.0.0.0',
|
||||||
help='proxy host')
|
help='proxy host')
|
||||||
parser.add_argument('--proxy_port', '--proxy-port', default=0, type=int,
|
parser.add_argument('--proxy_port', '--proxy-port', default=0, type=int,
|
||||||
help='proxy port')
|
help='proxy port')
|
||||||
parser.add_argument('--proxy_type', '--proxy-type', default=0, type=int,
|
parser.add_argument('--proxy_type', '--proxy-type', default=0, type=int,
|
||||||
choices=[0,1,2],
|
choices=[0,1,2],
|
||||||
help='proxy type 1=http, 2=socks')
|
help='proxy type 1=http, 2=socks')
|
||||||
|
parser.add_argument('--tcp_port', '--tcp-port', default=0, type=int,
|
||||||
|
help='tcp port')
|
||||||
parser.add_argument('--udp_enabled', type=str, default='True',
|
parser.add_argument('--udp_enabled', type=str, default='True',
|
||||||
choices=['True', 'False'],
|
choices=['True', 'False'],
|
||||||
help='En/Disable udp')
|
help='En/Disable udp')
|
||||||
@ -297,26 +319,26 @@ def oMainArgparser(_=None, iMode=2):
|
|||||||
choices=['True', 'False'],
|
choices=['True', 'False'],
|
||||||
help='Download nodes list')
|
help='Download nodes list')
|
||||||
parser.add_argument('--nodes_json', type=str,
|
parser.add_argument('--nodes_json', type=str,
|
||||||
default='')
|
default=sNodesJson)
|
||||||
parser.add_argument('--network', type=str,
|
parser.add_argument('--network', type=str,
|
||||||
choices=['old', 'main', 'local'],
|
choices=['main', 'local'],
|
||||||
default='main')
|
default='main')
|
||||||
parser.add_argument('--download_nodes_url', type=str,
|
parser.add_argument('--download_nodes_url', type=str,
|
||||||
default='https://nodes.tox.chat/json')
|
default='https://nodes.tox.chat/json')
|
||||||
parser.add_argument('--logfile', default='',
|
parser.add_argument('--logfile', default=logfile,
|
||||||
help='Filename for logging - start with + for stdout too')
|
help='Filename for logging - start with + for stdout too')
|
||||||
parser.add_argument('--loglevel', default=logging.INFO, type=int,
|
parser.add_argument('--loglevel', default=logging.INFO, type=int,
|
||||||
# choices=[logging.info,logging.trace,logging.debug,logging.error]
|
# choices=[logging.info,logging.trace,logging.debug,logging.error]
|
||||||
help='Threshold for logging (lower is more) default: 20')
|
help='Threshold for logging (lower is more) default: 20')
|
||||||
parser.add_argument('--tcp_port', '--tcp-port', default=0, type=int,
|
|
||||||
help='tcp port')
|
|
||||||
parser.add_argument('--mode', type=int, default=iMode,
|
parser.add_argument('--mode', type=int, default=iMode,
|
||||||
choices=[0,1,2],
|
choices=[0,1,2],
|
||||||
help='Mode: 0=chat 1=chat+audio 2=chat+audio+video default: 0')
|
help='Mode: 0=chat 1=chat+audio 2=chat+audio+video default: 0')
|
||||||
parser.add_argument('--sleep', type=str, default='time',
|
parser.add_argument('--hole_punching_enabled',type=str,
|
||||||
# could expand this to tk, gtk, gevent...
|
default='False', choices=['True','False'],
|
||||||
choices=['qt','gevent','time'],
|
help='En/Enable hole punching')
|
||||||
help='Sleep method - one of qt, gevent , time')
|
parser.add_argument('--dht_announcements_enabled',type=str,
|
||||||
|
default='True', choices=['True','False'],
|
||||||
|
help='En/Disable DHT announcements')
|
||||||
return parser
|
return parser
|
||||||
|
|
||||||
def vSetupLogging(oArgs):
|
def vSetupLogging(oArgs):
|
||||||
@ -471,7 +493,7 @@ def lSdSamplerates(iDev):
|
|||||||
return supported_samplerates
|
return supported_samplerates
|
||||||
|
|
||||||
def _get_nodes_path(oArgs=None):
|
def _get_nodes_path(oArgs=None):
|
||||||
if oArgs and hasattr(oArgs, 'nodes_json') and oArgs.nodes_json:
|
if oArgs and oArgs.nodes_json and os.path.isfile(oArgs.nodes_json):
|
||||||
LOG.debug("_get_nodes_path: " +oArgs.nodes_json)
|
LOG.debug("_get_nodes_path: " +oArgs.nodes_json)
|
||||||
default = oArgs.nodes_json
|
default = oArgs.nodes_json
|
||||||
elif get_user_config_path:
|
elif get_user_config_path:
|
||||||
@ -486,10 +508,9 @@ DEFAULT_NODES_COUNT = 8
|
|||||||
|
|
||||||
global aNODES
|
global aNODES
|
||||||
aNODES = {}
|
aNODES = {}
|
||||||
import functools
|
|
||||||
|
|
||||||
|
|
||||||
# @functools.lru_cache(maxsize=12)
|
# @functools.lru_cache(maxsize=12) TypeError: unhashable type: 'Namespace'
|
||||||
def generate_nodes(oArgs=None,
|
def generate_nodes(oArgs=None,
|
||||||
nodes_count=DEFAULT_NODES_COUNT,
|
nodes_count=DEFAULT_NODES_COUNT,
|
||||||
ipv='ipv4',
|
ipv='ipv4',
|
||||||
@ -572,7 +593,7 @@ def tox_bootstrapd_port():
|
|||||||
port = int(line[7:])
|
port = int(line[7:])
|
||||||
return port
|
return port
|
||||||
|
|
||||||
def bootstrap_local(self, elts, lToxes):
|
def bootstrap_local(elts, lToxes, oArgs=None):
|
||||||
if os.path.exists('/run/tox-bootstrapd/tox-bootstrapd.pid'):
|
if os.path.exists('/run/tox-bootstrapd/tox-bootstrapd.pid'):
|
||||||
LOG.debug('/run/tox-bootstrapd/tox-bootstrapd.pid')
|
LOG.debug('/run/tox-bootstrapd/tox-bootstrapd.pid')
|
||||||
iRet = True
|
iRet = True
|
||||||
@ -581,11 +602,12 @@ def bootstrap_local(self, elts, lToxes):
|
|||||||
if iRet > 0:
|
if iRet > 0:
|
||||||
LOG.warn(f'bootstraping local No local DHT running')
|
LOG.warn(f'bootstraping local No local DHT running')
|
||||||
LOG.info(f'bootstraping local')
|
LOG.info(f'bootstraping local')
|
||||||
return bootstrap_udp(self, elts, lToxes)
|
return bootstrap_udp(elts, lToxes, oArgs)
|
||||||
|
|
||||||
def lDNSClean(l):
|
def lDNSClean(l):
|
||||||
# [elt for elt in l if elt not in lDEAD_BS]
|
global lDEAD_BS
|
||||||
return list(set(l).difference(lDEAD_BS))
|
# list(set(l).difference(set(lDEAD_BS)))
|
||||||
|
return [elt for elt in l if elt not in lDEAD_BS]
|
||||||
|
|
||||||
def lExitExcluder(oArgs, iPort=9051):
|
def lExitExcluder(oArgs, iPort=9051):
|
||||||
"""
|
"""
|
||||||
@ -625,29 +647,33 @@ def lExitExcluder(oArgs, iPort=9051):
|
|||||||
LOG.exception('ExcludeExitNodes ' +str(e))
|
LOG.exception('ExcludeExitNodes ' +str(e))
|
||||||
return exit_excludelist
|
return exit_excludelist
|
||||||
|
|
||||||
|
aHOSTS = {}
|
||||||
|
@functools.lru_cache(maxsize=20)
|
||||||
def sDNSLookup(host):
|
def sDNSLookup(host):
|
||||||
|
global aHOSTS
|
||||||
ipv = 0
|
ipv = 0
|
||||||
if host in lDEAD_BS:
|
if host in lDEAD_BS:
|
||||||
LOG.warn(f"address skipped because in lDEAD_BS {host}")
|
# LOG.warn(f"address skipped because in lDEAD_BS {host}")
|
||||||
return ''
|
return ''
|
||||||
# return host
|
if host in aHOSTS:
|
||||||
|
return aHOSTS[host]
|
||||||
|
|
||||||
try:
|
try:
|
||||||
s = host.replace('.','')
|
s = host.replace('.','')
|
||||||
int(s)
|
int(s)
|
||||||
|
ipv = 4
|
||||||
except:
|
except:
|
||||||
try:
|
try:
|
||||||
s = host.replace(':','')
|
s = host.replace(':','')
|
||||||
int(s)
|
int(s)
|
||||||
except: pass
|
|
||||||
else:
|
|
||||||
ipv = 6
|
ipv = 6
|
||||||
else:
|
except: pass
|
||||||
ipv = 4
|
|
||||||
|
|
||||||
if ipv > 0:
|
if ipv > 0:
|
||||||
# LOG.debug(f"{ipv} IP address {host}")
|
# LOG.debug(f"v={ipv} IP address {host}")
|
||||||
return host
|
return host
|
||||||
|
|
||||||
|
LOG.debug(f"sDNSLookup {host}")
|
||||||
ip = ''
|
ip = ''
|
||||||
if host.endswith('.tox') or host.endswith('.onion'):
|
if host.endswith('.tox') or host.endswith('.onion'):
|
||||||
if False and stem:
|
if False and stem:
|
||||||
@ -677,7 +703,11 @@ def sDNSLookup(host):
|
|||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
ip = socket.gethostbyname(host)
|
ip = socket.gethostbyname(host)
|
||||||
|
LOG.debug(f"host={host} gethostbyname IP address {ip}")
|
||||||
|
if ip:
|
||||||
|
aHOSTS[host] = ip
|
||||||
return ip
|
return ip
|
||||||
|
# drop through
|
||||||
except:
|
except:
|
||||||
# drop through
|
# drop through
|
||||||
pass
|
pass
|
||||||
@ -685,62 +715,77 @@ def sDNSLookup(host):
|
|||||||
if ip == '':
|
if ip == '':
|
||||||
try:
|
try:
|
||||||
sout = f"/tmp/TR{os.getpid()}.log"
|
sout = f"/tmp/TR{os.getpid()}.log"
|
||||||
i = os.system(f"dig {host}|grep ^{host}|sed -e 's/.* //'> {sout}")
|
i = os.system(f"dig {host} +timeout=15|grep ^{host}|sed -e 's/.* //'> {sout}")
|
||||||
if not i:
|
if not i:
|
||||||
LOG.warn(f"address skipped because dig failed on {host}")
|
LOG.warn(f"address skipped because dig failed on {host}")
|
||||||
return ''
|
return ''
|
||||||
ip = open(sout, 'rt').read().strip()
|
ip = open(sout, 'rt').read().strip()
|
||||||
LOG.debug(f"address dig {ip} on {host}")
|
LOG.debug(f"address dig {ip} on {host}")
|
||||||
|
aHOSTS[host] = ip
|
||||||
return ip
|
return ip
|
||||||
except:
|
except:
|
||||||
ip = host
|
ip = host
|
||||||
LOG.debug(f'sDNSLookup {host} -> {ip}')
|
LOG.debug(f'sDNSLookup {host} -> {ip}')
|
||||||
|
if ip and ip != host:
|
||||||
|
aHOSTS[host] = ip
|
||||||
return ip
|
return ip
|
||||||
|
|
||||||
def bootstrap_good(lelts, lToxes):
|
def bootstrap_udp(lelts, lToxes, oArgs=None):
|
||||||
return bootstrap_udp(lelts, lToxes)
|
|
||||||
|
|
||||||
def bootstrap_udp(lelts, lToxes):
|
|
||||||
lelts = lDNSClean(lelts)
|
lelts = lDNSClean(lelts)
|
||||||
LOG.debug(f'DHT bootstraping {len(lelts)}')
|
socket.setdefaulttimeout(15.0)
|
||||||
for elt in lToxes:
|
for oTox in lToxes:
|
||||||
random.shuffle(lelts)
|
random.shuffle(lelts)
|
||||||
|
if hasattr(oTox, 'oArgs'):
|
||||||
|
oArgs = oTox.oArgs
|
||||||
|
if hasattr(oArgs, 'contents') and oArgs.contents.proxy_type != 0:
|
||||||
|
lelts = lelts[:1]
|
||||||
|
|
||||||
|
# LOG.debug(f'bootstrap_udp DHT bootstraping {oTox.name} {len(lelts)}')
|
||||||
for largs in lelts:
|
for largs in lelts:
|
||||||
|
assert len(largs) == 3
|
||||||
host, port, key = largs
|
host, port, key = largs
|
||||||
|
assert host; assert port; assert key
|
||||||
|
if host in lDEAD_BS: continue
|
||||||
ip = sDNSLookup(host)
|
ip = sDNSLookup(host)
|
||||||
if not ip:
|
if not ip:
|
||||||
LOG.warn(f'bootstrap_udp to {host} did not resolve')
|
LOG.warn(f'bootstrap_udp to host={host} port={port} did not resolve ip={ip}')
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if type(port) == str:
|
if type(port) == str:
|
||||||
port = int(port)
|
port = int(port)
|
||||||
try:
|
try:
|
||||||
assert len(key) == 64, key
|
assert len(key) == 64, key
|
||||||
oRet = elt.bootstrap(ip,
|
# NOT ip
|
||||||
|
oRet = oTox.bootstrap(host,
|
||||||
port,
|
port,
|
||||||
key)
|
key)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
LOG.error(f'bootstrap to {host}:' +str(largs[1]) \
|
if oArgs is None or (
|
||||||
+' ' +str(e))
|
hasattr(oArgs, 'contents') and oArgs.contents.proxy_type == 0):
|
||||||
|
pass
|
||||||
|
# LOG.error(f'bootstrap_udp failed to host={host} port={port} {e}')
|
||||||
continue
|
continue
|
||||||
if not oRet:
|
if not oRet:
|
||||||
LOG.warn(f'bootstrap failed to {host} : ' +str(oRet))
|
LOG.warn(f'bootstrap_udp failed to {host} : {oRet}')
|
||||||
elif elt.self_get_connection_status() != TOX_CONNECTION['NONE']:
|
elif oTox.self_get_connection_status() != TOX_CONNECTION['NONE']:
|
||||||
LOG.info(f'bootstrap to {host} connected')
|
LOG.info(f'bootstrap_udp to {host} connected')
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
LOG.debug(f'bootstrap to {host} not connected')
|
# LOG.debug(f'bootstrap_udp to {host} not connected')
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def bootstrap_tcp(lelts, lToxes):
|
def bootstrap_tcp(lelts, lToxes, oArgs=None):
|
||||||
lelts = lDNSClean(lelts)
|
lelts = lDNSClean(lelts)
|
||||||
for oTox in lToxes:
|
for oTox in lToxes:
|
||||||
|
if hasattr(oTox, 'oArgs'): oArgs = oTox.oArgs
|
||||||
random.shuffle(lelts)
|
random.shuffle(lelts)
|
||||||
LOG.info(f'bootstrap_tcp bootstapping {[l[0] for l in lelts]}')
|
# LOG.debug(f'bootstrap_tcp bootstapping {oTox.name} {len(lelts)}')
|
||||||
for (host, port, key,) in lelts:
|
for (host, port, key,) in lelts:
|
||||||
|
assert host; assert port;assert key
|
||||||
|
if host in lDEAD_BS: continue
|
||||||
ip = sDNSLookup(host)
|
ip = sDNSLookup(host)
|
||||||
if not ip:
|
if not ip:
|
||||||
LOG.warn(f'bootstrap_tcp to {host} did not resolve {ip}')
|
LOG.warn(f'bootstrap_tcp to {host} did not resolve ip={ip}')
|
||||||
# continue
|
# continue
|
||||||
ip = host
|
ip = host
|
||||||
if host.endswith('.onion') and stem:
|
if host.endswith('.onion') and stem:
|
||||||
@ -759,12 +804,19 @@ def bootstrap_tcp(lelts, lToxes):
|
|||||||
LOG.error(f'bootstrap_tcp to {host} : ' +str(e))
|
LOG.error(f'bootstrap_tcp to {host} : ' +str(e))
|
||||||
continue
|
continue
|
||||||
if not oRet:
|
if not oRet:
|
||||||
LOG.warn(f'bootstrap_tcp failed to {host} : ' +str(oRet))
|
LOG.warn(f'bootstrap_tcp failed to {host} : {oRet}')
|
||||||
|
elif oTox.mycon_time == 1:
|
||||||
|
LOG.info(f'bootstrap_tcp to {host} not yet connected last=1')
|
||||||
|
elif oTox.mycon_status is False:
|
||||||
|
LOG.info(f'bootstrap_tcp to {host} not True' \
|
||||||
|
+f" last={int(oTox.mycon_time)}" )
|
||||||
elif oTox.self_get_connection_status() != TOX_CONNECTION['NONE']:
|
elif oTox.self_get_connection_status() != TOX_CONNECTION['NONE']:
|
||||||
LOG.info(f'bootstrap_tcp to {host} connected')
|
LOG.info(f'bootstrap_tcp to {host} connected' \
|
||||||
|
+f" last={int(oTox.mycon_time)}" )
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
LOG.debug(f'bootstrap_tcp to {host} but not connected')
|
LOG.debug(f'bootstrap_tcp to {host} but not connected' \
|
||||||
|
+f" last={int(oTox.mycon_time)}" )
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def iNmapInfoNmap(sProt, sHost, sPort, key=None, environ=None, cmd=''):
|
def iNmapInfoNmap(sProt, sHost, sPort, key=None, environ=None, cmd=''):
|
||||||
@ -812,13 +864,16 @@ 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
|
||||||
|
if os.environ['USER'] != 'root':
|
||||||
|
LOG.warn(f"bootstrap_iNmapInfo not ROOT")
|
||||||
|
return True
|
||||||
|
|
||||||
lRetval = []
|
lRetval = []
|
||||||
for elts in lElts[:iNODES]:
|
for elts in lElts[:iNODES]:
|
||||||
host, port, key = elts
|
host, port, key = elts
|
||||||
ip = sDNSLookup(host)
|
ip = sDNSLookup(host)
|
||||||
if not ip:
|
if not ip:
|
||||||
LOG.info('bootstrap_iNmapInfo to {host} did not resolve')
|
LOG.info('bootstrap_iNmapInfo to {host} did not resolve ip={ip}')
|
||||||
continue
|
continue
|
||||||
if type(port) == str:
|
if type(port) == str:
|
||||||
port = int(port)
|
port = int(port)
|
||||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user