aboutsummaryrefslogtreecommitdiff
path: root/cli
diff options
context:
space:
mode:
authorMicah Lee <micah@micahflee.com>2022-06-20 09:14:26 -0700
committerMicah Lee <micah@micahflee.com>2022-06-20 09:14:26 -0700
commita447423049b9d8b5fbeb58d83f14d875c4f5ec22 (patch)
treea238101013434e91f5de6b3731a6570a6693b2f6 /cli
parentf572623528b643926e00837647e692ba865fd7be (diff)
parent0e5b9bbf6b644956a77d0cab00046185f9db7c9c (diff)
downloadonionshare-a447423049b9d8b5fbeb58d83f14d875c4f5ec22.tar.gz
onionshare-a447423049b9d8b5fbeb58d83f14d875c4f5ec22.zip
Merge branch 'develop' into ci-builds
Diffstat (limited to 'cli')
-rw-r--r--cli/onionshare_cli/censorship.py25
1 files changed, 18 insertions, 7 deletions
diff --git a/cli/onionshare_cli/censorship.py b/cli/onionshare_cli/censorship.py
index 9268f578..4cff4862 100644
--- a/cli/onionshare_cli/censorship.py
+++ b/cli/onionshare_cli/censorship.py
@@ -78,6 +78,7 @@ class CensorshipCircumvention(object):
Note that this API endpoint doesn't return actual bridges,
it just returns the recommended bridge type countries.
"""
+ self.common.log("CensorshipCircumvention", "request_map", f"country={country}")
if not self.api_proxies:
return False
endpoint = "https://bridges.torproject.org/moat/circumvention/map"
@@ -126,6 +127,11 @@ class CensorshipCircumvention(object):
Optionally, a list of transports can be specified in order to
return recommended settings for just that transport type.
"""
+ self.common.log(
+ "CensorshipCircumvention",
+ "request_settings",
+ f"country={country}, transports={transports}",
+ )
if not self.api_proxies:
return False
endpoint = "https://bridges.torproject.org/moat/circumvention/settings"
@@ -155,6 +161,11 @@ class CensorshipCircumvention(object):
return False
result = r.json()
+ self.common.log(
+ "CensorshipCircumvention",
+ "request_settings",
+ f"result={result}",
+ )
if "errors" in result:
self.common.log(
@@ -167,7 +178,7 @@ class CensorshipCircumvention(object):
# There are no settings - perhaps this country doesn't require censorship circumvention?
# This is not really an error, so we can just check if False and assume direct Tor
# connection will work.
- if not "settings" in result:
+ if not "settings" in result or result["settings"] is None:
self.common.log(
"CensorshipCircumvention",
"request_settings",
@@ -218,6 +229,12 @@ class CensorshipCircumvention(object):
"""
Checks the bridges and saves them in settings.
"""
+ self.common.log(
+ "CensorshipCircumvention",
+ "save_settings",
+ f"bridge_settings: {bridge_settings}",
+ )
+
bridges_ok = False
self.settings = settings
@@ -226,11 +243,6 @@ class CensorshipCircumvention(object):
# But if so, how to stop it starting 3 separate Tor connection threads?
# for bridges in request_bridges["settings"]:
bridges = bridge_settings["settings"][0]["bridges"]
- self.common.log(
- "CensorshipCircumvention",
- "save_settings",
- f"Obtained bridges: {bridges}",
- )
bridge_strings = bridges["bridge_strings"]
self.settings.set("bridges_type", "custom")
@@ -260,7 +272,6 @@ class CensorshipCircumvention(object):
)
return False
-
def request_default_bridges(self):
"""
Retrieves the list of default fall-back bridges from the Tor Project.