Refactor to CensorshipCircumvention and Meek classes. Use Meek domain fronting when requesting bridges in frontend

This commit is contained in:
Miguel Jacq 2021-10-19 11:36:03 +11:00
parent bcf697574e
commit 5b4d77c363
No known key found for this signature in database
GPG key ID: EEA4341C6D97A0B6
6 changed files with 202 additions and 79 deletions

View file

@ -28,6 +28,7 @@ from datetime import timedelta
from .common import Common, CannotFindTor
from .censorship import CensorshipCircumvention
from .meek import Meek, MeekNotRunning
from .web import Web
from .onion import TorErrorProtocolError, TorTooOldEphemeral, TorTooOldStealth, Onion
from .onionshare import OnionShare
@ -284,6 +285,18 @@ def main(cwd=None):
# Create the Web object
web = Web(common, False, mode_settings, mode)
# Create the Meek object and start the meek client
meek = Meek(common)
meek.start()
# Create the CensorshipCircumvention object to make
# API calls to Tor over Meek
censorship = CensorshipCircumvention(common, meek)
# Example: request recommended bridges, pretending to be from China, using
# domain fronting.
# censorship_recommended_settings = censorship.request_settings(country="cn")
# print(censorship_recommended_settings)
# Start the Onion object
try:
onion = Onion(common, use_tmp_dir=True)