tor-commits
Threads by month
- ----- 2025 -----
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
November 2017
- 16 participants
- 2019 discussions
commit f23f3630321e4b98db7ef47dfb596eb06ad94abb
Merge: 96707e2 513cd25
Author: Isis Lovecruft <isis(a)torproject.org>
Date: Sat Oct 28 00:27:59 2017 +0000
Merge branch 'master' into develop
CHANGELOG | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
1
0
commit 5a09a99ba05412e8f08323a54abeb927c024c57e
Author: Isis Lovecruft <isis(a)torproject.org>
Date: Wed Nov 1 20:56:03 2017 +0000
Fix typo in docstring.
---
bridgedb/distributors/https/server.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/bridgedb/distributors/https/server.py b/bridgedb/distributors/https/server.py
index 3e4284f..85a32b3 100644
--- a/bridgedb/distributors/https/server.py
+++ b/bridgedb/distributors/https/server.py
@@ -81,7 +81,7 @@ SERVER_PUBLIC_FQDN = None
def setFQDN(fqdn, https=True):
- """Set the global :data:`SERVER_PUBLIC FQDN` variable.
+ """Set the global :data:`SERVER_PUBLIC_FQDN` variable.
:param str fqdn: The public, fully-qualified domain name of the HTTP
server that will serve this resource.
1
0
commit 9d452247e4378a44e46fb31b14acf2238e4d9dd6
Author: Isis Lovecruft <isis(a)torproject.org>
Date: Tue Sep 12 21:33:22 2017 +0000
Specify the moat API.
* FIXES part of https://bugs.torproject.org/22871
---
README.rst | 173 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 173 insertions(+)
diff --git a/README.rst b/README.rst
index faeae5c..a2d3b27 100644
--- a/README.rst
+++ b/README.rst
@@ -420,6 +420,179 @@ e.g. bridges@...) and sent from an ``(a)riseup.net``, ``(a)gmail.com``, or
You can email our BridgeDB instance `here <mailto:bridges@torproject.org>`__.
+
+----------------------------
+Accessing the Moat Interface
+----------------------------
+
+Moat is a bridge distributor for requesting bridges through `Tor Launcher's
+<https://gitweb.torproject.org/tor-launcher.git/>`__ user interface.
+
+The following describes the Moat API, version 0.1.0.
+
+The client and server both MUST conform to `JSON-API <http://jsonapi.org/>`__.
+
+The client SHOULD direct all requests via the Meek reflector at ``MEEK_REFECTOR``.
+..
+ XXX meek reflector URL
+
+Requesting Bridges
+""""""""""""""""""
+
+The client MUST send a ``POST /meek/moat/fetch`` containing the following JSON::
+
+ {
+ 'data': {
+ 'version': '0.1.0',
+ 'type': 'moat client supported transports',
+ 'supported': [ 'TRANSPORT', 'TRANSPORT', ... ],
+ }
+ }
+
+where:
+
+* ``TRANSPORT`` is a string identifying a transport, e.g. ``"obfs3"`` or
+ ``"obfs4"``. Currently supported transport identifiers are:
+ - ``"vanilla"``
+ - ``"fte"``
+ - ``"obfs3"``
+ - ``"obfs4"``
+ - ``"scramblesuit"``
+
+
+Receiving a CAPTCHA challenge
+"""""""""""""""""""""""""""""
+
+The moat server will respond with ``200 OK``.
+
+If there is no overlap with the transports which BridgeDB supports, the moat
+server will respond with the list of transports which is *does* support::
+
+ {
+ 'data': {
+ 'version': '0.1.0',
+ 'type': 'moat server supported transports',
+ 'supported': [ 'TRANSPORT', 'TRANSPORT', ... ],
+ }
+ }
+
+If there is an overlap with what BridgeDB supports, the moat server will select
+the "best" transport from the list of supported transports, and respond with the
+following JSON containing a CAPTCHA challenge::
+
+ {
+ 'data': {
+ 'id': 1,
+ 'type': 'moat farfetchd challenge',
+ 'version': '0.1.0',
+ 'transport': TRANSPORT,
+ 'image': CAPTCHA,
+ 'challenge': CHALLENGE,
+ }
+ }
+
+where:
+
+* ``TRANSPORT`` is the agreed upon transport which will be distributed,
+* ``CAPTCHA`` is a base64-encoded, jpeg image that is 400 pixels in
+ length and 125 pixels in height,
+* ``CHALLENGE`` is a base64-encoded CAPTCHA challenge which MUST be
+ later passed back to the server along with the proposed solution.
+
+The challenge contains an encrypted-then-HMACed timestamp, and
+solutions submitted more than 30 minutes after requesting the CAPTCHA
+are considered invalid.
+
+
+Responding to a CAPTCHA challenge
+"""""""""""""""""""""""""""""""""
+
+To propose a solution to a CAPTCHA, the client MUST send a request for ``POST
+/meek/moat/check``, where the body of the request contains the following JSON::
+
+ {
+ 'data': {
+ 'id': 2,
+ 'type': 'moat farfetchd solution',
+ 'version': '0.1.0',
+ 'transport': TRANSPORT,
+ 'challenge': CHALLENGE,
+ 'solution': SOLUTION,
+ 'qrcode': BOOLEAN,
+ }
+ }
+
+
+where:
+
+* ``TRANSPORT`` is the agreed upon transport which will be distributed,
+* ``CHALLENGE`` is a base64-encoded CAPTCHA challenge which MUST be
+ later passed back to the server along with the proposed solution.
+* ``SOLUTION`` is a valid unicode string, up to 20 bytes in length,
+ containing the client's answer (i.e. what characters the CAPTCHA
+ image displayed). The solution is *not* case-sensitive.
+* ``BOOLEAN`` is ``'true'`` if the client wants a qrcode containing the bridge
+ lines to be generated and returned; ``'false'`` otherwise.
+
+
+Receiving Bridges
+"""""""""""""""""
+
+If the ``CHALLENGE`` has already timed out, or if the ``SOLUTION`` was
+incorrect, the server SHOULD respond with ``419 No You're A Teapot``.
+
+If the ``SOLUTION`` was successful for the supplied ``CHALLENGE``, the
+server responds ``200 OK`` with the following JSON::
+
+ {
+ 'data': {
+ 'id': 3,
+ 'type': 'moat bridges',
+ 'version': '0.1.0',
+ 'bridges': [ 'BRIDGE_LINE', ... ],
+ 'qrcode': QRCODE,
+ }
+ }
+
+where:
+
+* ``BRIDGE_LINE`` is a bridge line suitable for configuration in a torrc,
+* ``QRCODE`` is a base64-encoded jpeg image of a QRCode containing all the
+ ``BRIDGE_LINE``, if one was requested, otherwise this field will be ``NaN``.
+
+..
+ XXX do we care to differentiate the errors for "unable to distribute
+ bridges"? are any of these useful to Tor Launcher?
+
+If the ``SOLUTION`` was successful for the supplied ``CHALLENGE``, but the
+server is unable to distribute the requested Bridges, the server responds ``200
+OK`` with the following JSON::
+
+ {
+ 'error': {
+ 'id': 1,
+ 'code': '404',
+ 'status': 'Not Found',
+ 'title': 'Could not fetch the type of bridges you requested',
+ 'detail': DETAILS,
+ }
+ }
+
+where:
+
+* ``DETAILS`` is some string describing the detailed nature of the issue.
+
+
+Other Responses
+"""""""""""""""
+
+If the client requested some page other than ``/meek/moat/fetch``, or
+``/meek/moat/check``, the server MUST respond with ``501 Not Implemented``.
+
+If the client attempts any other HTTP method, other than ``POST``, the server
+MUST respond ``403 FORBIDDEN``.
+
+
=================
Contact & Support
=================
1
0

[bridgedb/master] Make new bridgedb.distributors package and put distributor code there.
by isis@torproject.org 15 Nov '17
by isis@torproject.org 15 Nov '17
15 Nov '17
commit fca25fc8d9295ab50cb2a1be39199c213ddf8751
Author: Isis Lovecruft <isis(a)torproject.org>
Date: Wed Nov 1 20:44:24 2017 +0000
Make new bridgedb.distributors package and put distributor code there.
---
bridgedb/Bridges.py | 2 +-
bridgedb/Main.py | 16 ++++----
bridgedb/distributors/__init__.py | 5 +++
bridgedb/distributors/email/__init__.py | 8 ++++
bridgedb/{ => distributors}/email/autoresponder.py | 24 +++++------
bridgedb/{ => distributors}/email/distributor.py | 10 ++---
bridgedb/{ => distributors}/email/dkim.py | 6 +--
bridgedb/{ => distributors}/email/request.py | 12 +++---
bridgedb/{ => distributors}/email/server.py | 30 +++++++-------
bridgedb/{ => distributors}/email/templates.py | 6 +--
bridgedb/{ => distributors}/https/__init__.py | 4 ++
bridgedb/{ => distributors}/https/distributor.py | 8 ++--
bridgedb/{ => distributors}/https/request.py | 8 ++--
bridgedb/{ => distributors}/https/server.py | 8 ++--
.../https/templates/assets/css/bootstrap.min.css | 0
.../https/templates/assets/css/error.css | 0
.../templates/assets/css/font-awesome-ie7.min.css | 0
.../templates/assets/css/font-awesome.min.css | 0
.../https/templates/assets/css/main.css | 0
.../https/templates/assets/css/rtl.css | 0
.../templates/assets/font/fontawesome-webfont.eot | Bin
.../templates/assets/font/fontawesome-webfont.svg | 0
.../templates/assets/font/fontawesome-webfont.ttf | Bin
.../templates/assets/font/fontawesome-webfont.woff | Bin
.../https/templates/assets/font/lato-bold.woff | Bin
.../https/templates/assets/font/lato-italic.woff | Bin
.../https/templates/assets/font/lato-regular.woff | Bin
.../templates/assets/images/404-excavator.svg | 0
.../templates/assets/images/404-hills-left.svg | 0
.../templates/assets/images/404-hills-right.svg | 0
.../assets/images/500-hills-left-shade.svg | 0
.../templates/assets/images/500-hills-left.svg | 0
.../assets/images/500-hills-right-shade.svg | 0
.../templates/assets/images/500-hills-right.svg | 0
.../https/templates/assets/images/500-road.svg | 0
.../assets/images/maintenance-hills-left-shade.svg | 0
.../assets/images/maintenance-hills-left.svg | 0
.../images/maintenance-hills-right-shade.svg | 0
.../assets/images/maintenance-hills-right.svg | 0
.../assets/images/maintenance-tractor.svg | 0
.../https/templates/assets/js/bridges.js | 0
.../https/templates/assets/tor-roots-blue.svg | 0
.../https/templates/assets/tor.svg | 0
.../{ => distributors}/https/templates/base.html | 0
.../https/templates/bridges.html | 0
.../https/templates/captcha.html | 0
.../https/templates/error-404.html | 0
.../https/templates/error-500.html | 0
.../https/templates/error-503.html | 0
.../{ => distributors}/https/templates/howto.html | 0
.../{ => distributors}/https/templates/index.html | 0
.../https/templates/options.html | 0
.../{ => distributors}/https/templates/robots.txt | 0
bridgedb/email/__init__.py | 1 -
bridgedb/parse/addr.py | 4 +-
bridgedb/persistent.py | 4 +-
bridgedb/strings.py | 4 +-
bridgedb/test/email_helpers.py | 14 +++----
bridgedb/test/https_helpers.py | 4 +-
bridgedb/test/legacy_Tests.py | 6 +--
bridgedb/test/test_email_autoresponder.py | 14 +++----
bridgedb/test/test_email_distributor.py | 12 +++---
bridgedb/test/test_email_dkim.py | 4 +-
bridgedb/test/test_email_request.py | 4 +-
bridgedb/test/test_email_server.py | 20 +++++-----
bridgedb/test/test_email_templates.py | 4 +-
bridgedb/test/test_https_distributor.py | 6 +--
bridgedb/test/test_https_request.py | 4 +-
bridgedb/test/test_https_server.py | 44 ++++++++++-----------
doc/sphinx/source/conf.py | 22 +++++------
setup.py | 9 +++--
71 files changed, 172 insertions(+), 155 deletions(-)
diff --git a/bridgedb/Bridges.py b/bridgedb/Bridges.py
index ac403b6..50d70ae 100644
--- a/bridgedb/Bridges.py
+++ b/bridgedb/Bridges.py
@@ -541,7 +541,7 @@ class FilteredBridgeSplitter(object):
:ivar bridges: DOCDOC
:type distributorName: str
:ivar distributorName: The name of this splitter's distributor. See
- :meth:`~bridgedb.https.distributor.HTTPSDistributor.setDistributorName`.
+ :meth:`~bridgedb.distributors.https.distributor.HTTPSDistributor.setDistributorName`.
"""
self.key = key
self.filterRings = {}
diff --git a/bridgedb/Main.py b/bridgedb/Main.py
index 4273653..53b70c2 100644
--- a/bridgedb/Main.py
+++ b/bridgedb/Main.py
@@ -31,8 +31,8 @@ from bridgedb.bridges import ServerDescriptorDigestMismatch
from bridgedb.bridges import ServerDescriptorWithoutNetworkstatus
from bridgedb.bridges import Bridge
from bridgedb.configure import loadConfig
-from bridgedb.email.distributor import EmailDistributor
-from bridgedb.https.distributor import HTTPSDistributor
+from bridgedb.distributors.email.distributor import EmailDistributor
+from bridgedb.distributors.https.distributor import HTTPSDistributor
from bridgedb.parse import descriptors
from bridgedb.parse.blacklist import parseBridgeBlacklistFile
@@ -216,8 +216,8 @@ def createBridgeRings(cfg, proxyList, key):
:param bytes key: Hashring master key
:rtype: tuple
:returns: A BridgeSplitter hashring, an
- :class:`~bridgedb.https.distributor.HTTPSDistributor` or None, and an
- :class:`~bridgedb.email.distributor.EmailDistributor` or None.
+ :class:`~bridgedb.distributors.https.distributor.HTTPSDistributor` or None, and an
+ :class:`~bridgedb.distributors.email.distributor.EmailDistributor` or None.
"""
# Create a BridgeSplitter to assign the bridges to the different
# distributors.
@@ -316,8 +316,8 @@ def run(options, reactor=reactor):
state = persistent.State(config=config)
- from bridgedb.email.server import addServer as addSMTPServer
- from bridgedb.https.server import addWebServer
+ from bridgedb.distributors.email.server import addServer as addSMTPServer
+ from bridgedb.distributors.https.server import addWebServer
# Load the master key, or create a new one.
key = crypto.getKey(config.MASTER_KEY_FILE)
@@ -352,9 +352,9 @@ def run(options, reactor=reactor):
:ivar proxyList: The container for the IP addresses of any currently
known open proxies.
:ivar ipDistributor: A
- :class:`~bridgedb.https.distributor.HTTPSDistributor`.
+ :class:`~bridgedb.distributors.https.distributor.HTTPSDistributor`.
:ivar emailDistributor: A
- :class:`~bridgedb.email.distributor.EmailDistributor`.
+ :class:`~bridgedb.distributors.email.distributor.EmailDistributor`.
:ivar dict tasks: A dictionary of ``{name: task}``, where name is a
string to associate with the ``task``, and ``task`` is some
scheduled event, repetitive or otherwise, for the :class:`reactor
diff --git a/bridgedb/distributors/__init__.py b/bridgedb/distributors/__init__.py
new file mode 100644
index 0000000..951ef44
--- /dev/null
+++ b/bridgedb/distributors/__init__.py
@@ -0,0 +1,5 @@
+"""Methods for distributing bridges."""
+
+import email
+import https
+#import moat
diff --git a/bridgedb/distributors/email/__init__.py b/bridgedb/distributors/email/__init__.py
new file mode 100644
index 0000000..8f9ed03
--- /dev/null
+++ b/bridgedb/distributors/email/__init__.py
@@ -0,0 +1,8 @@
+"""Servers for BridgeDB's email bridge distributor."""
+
+import autoresponder
+import distributor
+import dkim
+import request
+import server
+import templates
diff --git a/bridgedb/email/autoresponder.py b/bridgedb/distributors/email/autoresponder.py
similarity index 97%
rename from bridgedb/email/autoresponder.py
rename to bridgedb/distributors/email/autoresponder.py
index 430a50c..ff65a73 100644
--- a/bridgedb/email/autoresponder.py
+++ b/bridgedb/distributors/email/autoresponder.py
@@ -13,10 +13,10 @@
#_____________________________________________________________________________
"""
-.. py:module:: bridgedb.email.autoresponder
+.. py:module:: bridgedb.distributors.email.autoresponder
:synopsis: Functionality for autoresponding to incoming emails.
-bridgedb.email.autoresponder
+bridgedb.distributors.email.autoresponder
============================
Functionality for autoresponding to incoming emails.
@@ -26,7 +26,7 @@ Functionality for autoresponding to incoming emails.
::
- bridgedb.email.autoresponder
+ bridgedb.distributors.email.autoresponder
| |_ createResponseBody - Parse lines from an incoming email and determine
| | how to respond.
| |_ generateResponse - Create an email response.
@@ -50,13 +50,13 @@ from twisted.python import failure
from bridgedb import safelog
from bridgedb.crypto import NEW_BUFFER_INTERFACE
-from bridgedb.email import dkim
-from bridgedb.email import request
-from bridgedb.email import templates
-from bridgedb.email.distributor import EmailRequestedHelp
-from bridgedb.email.distributor import EmailRequestedKey
-from bridgedb.email.distributor import TooSoonEmail
-from bridgedb.email.distributor import IgnoreEmail
+from bridgedb.distributors.email import dkim
+from bridgedb.distributors.email import request
+from bridgedb.distributors.email import templates
+from bridgedb.distributors.email.distributor import EmailRequestedHelp
+from bridgedb.distributors.email.distributor import EmailRequestedKey
+from bridgedb.distributors.email.distributor import TooSoonEmail
+from bridgedb.distributors.email.distributor import IgnoreEmail
from bridgedb.parse import addr
from bridgedb.parse.addr import canonicalizeEmailDomain
from bridgedb.util import levenshteinDistance
@@ -69,7 +69,7 @@ def createResponseBody(lines, context, client, lang='en'):
:param list lines: The list of lines from the original request sent by the
client.
- :type context: :class:`bridgedb.email.server.MailServerContext`
+ :type context: :class:`bridgedb.distributors.email.server.MailServerContext`
:param context: The context which contains settings for the email server.
:type client: :api:`twisted.mail.smtp.Address`
:param client: The client's email address which should be in the
@@ -614,7 +614,7 @@ class SMTPAutoresponder(smtp.SMTPClient):
3. Check that those canonical domains match.
4. If the incoming message is from a domain which supports DKIM
- signing, then run :func:`bridgedb.email.dkim.checkDKIM` as well.
+ signing, then run :func:`bridgedb.distributors.email.dkim.checkDKIM` as well.
.. note:: Calling this method sets the
:attr:`incoming.canonicalFromEmail` and
diff --git a/bridgedb/email/distributor.py b/bridgedb/distributors/email/distributor.py
similarity index 96%
rename from bridgedb/email/distributor.py
rename to bridgedb/distributors/email/distributor.py
index c6e45d5..06a0c50 100644
--- a/bridgedb/email/distributor.py
+++ b/bridgedb/distributors/email/distributor.py
@@ -11,10 +11,10 @@
# :license: see LICENSE for licensing information
"""
-.. py:module:: bridgedb.email.distributor
+.. py:module:: bridgedb.distributors.email.distributor
:synopsis: A Distributor which hands out Bridges via an email interface.
-bridgedb.email.autoresponder
+bridgedb.distributors.email.autoresponder
============================
A :class:`~bridgedb.distribute.Distributor` which hands out :class:`bridges
@@ -117,11 +117,11 @@ class EmailDistributor(Distributor):
.. hint:: All checks on the email address (which should be stored in
the ``bridgeRequest.client`` attribute), such as checks for
whitelisting and canonicalization of domain name, are done in
- :meth:`bridgedb.email.autoresponder.getMailTo` and
- :meth:`bridgedb.email.autoresponder.SMTPAutoresponder.runChecks`.
+ :meth:`bridgedb.distributors.email.autoresponder.getMailTo` and
+ :meth:`bridgedb.distributors.email.autoresponder.SMTPAutoresponder.runChecks`.
:type bridgeRequest:
- :class:`~bridgedb.email.request.EmailBridgeRequest`
+ :class:`~bridgedb.distributors.email.request.EmailBridgeRequest`
:param bridgeRequest: A
:class:`~bridgedb.bridgerequest.BridgeRequestBase` with the
:data:`~bridgedb.bridgerequest.BridgeRequestBase.client` attribute
diff --git a/bridgedb/email/dkim.py b/bridgedb/distributors/email/dkim.py
similarity index 95%
rename from bridgedb/email/dkim.py
rename to bridgedb/distributors/email/dkim.py
index c851c5c..be33d59 100644
--- a/bridgedb/email/dkim.py
+++ b/bridgedb/distributors/email/dkim.py
@@ -13,18 +13,18 @@
#_____________________________________________________________________________
"""
-.. py:module:: bridgedb.email.dkim
+.. py:module:: bridgedb.distributors.email.dkim
:synopsis: Functions for checking DKIM verification results in email
headers.
-bridgedb.email.dkim
+bridgedb.distributors.email.dkim
===================
Functions for checking DKIM verification results in email headers.
::
- bridgedb.email.dkim
+ bridgedb.distributors.email.dkim
|_ checkDKIM - Check the DKIM verification results header.
..
diff --git a/bridgedb/email/request.py b/bridgedb/distributors/email/request.py
similarity index 94%
rename from bridgedb/email/request.py
rename to bridgedb/distributors/email/request.py
index 71167c7..a490e56 100644
--- a/bridgedb/email/request.py
+++ b/bridgedb/distributors/email/request.py
@@ -13,11 +13,11 @@
#_____________________________________________________________________________
"""
-.. py:module:: bridgedb.email.request
+.. py:module:: bridgedb.distributors.email.request
:synopsis: Classes for parsing and storing information about requests for
bridges which are sent to the email distributor.
-bridgedb.email.request
+bridgedb.distributors.email.request
======================
Classes for parsing and storing information about requests for bridges
@@ -28,7 +28,7 @@ which are sent to the email distributor.
::
- bridgedb.email.request
+ bridgedb.distributors.email.request
| |_ determineBridgeRequestOptions - Figure out which filters to apply, or
| offer help.
|_ EmailBridgeRequest - A request for bridges which was received through
@@ -44,8 +44,8 @@ import logging
import re
from bridgedb import bridgerequest
-from bridgedb.email.distributor import EmailRequestedHelp
-from bridgedb.email.distributor import EmailRequestedKey
+from bridgedb.distributors.email.distributor import EmailRequestedHelp
+from bridgedb.distributors.email.distributor import EmailRequestedKey
#: A regular expression for matching the Pluggable Transport method TYPE in
@@ -109,7 +109,7 @@ class EmailBridgeRequest(bridgerequest.BridgeRequestBase):
def __init__(self):
"""Process a new bridge request received through the
- :class:`~bridgedb.email.distributor.EmailDistributor`.
+ :class:`~bridgedb.distributors.email.distributor.EmailDistributor`.
"""
super(EmailBridgeRequest, self).__init__()
self._wantsKey = False
diff --git a/bridgedb/email/server.py b/bridgedb/distributors/email/server.py
similarity index 95%
rename from bridgedb/email/server.py
rename to bridgedb/distributors/email/server.py
index 41862e7..229f118 100644
--- a/bridgedb/email/server.py
+++ b/bridgedb/distributors/email/server.py
@@ -14,11 +14,11 @@
"""
-.. py:module:: bridgedb.email.server
+.. py:module:: bridgedb.distributors.email.server
:synopsis: Servers which interface with clients and distribute bridges
over SMTP.
-bridgedb.email.server
+bridgedb.distributors.email.server
=====================
Servers which interface with clients and distribute bridges over SMTP.
@@ -28,7 +28,7 @@ Servers which interface with clients and distribute bridges over SMTP.
::
- bridgedb.email.server
+ bridgedb.distributors.email.server
| |_ addServer - Set up a SMTP server which listens on the configured
| EMAIL_PORT for incoming connections, and responds as
| necessary to requests for bridges.
@@ -66,9 +66,9 @@ from zope.interface import implements
from bridgedb import __version__
from bridgedb import safelog
from bridgedb.crypto import initializeGnuPG
-from bridgedb.email import autoresponder
-from bridgedb.email import templates
-from bridgedb.email import request
+from bridgedb.distributors.email import autoresponder
+from bridgedb.distributors.email import templates
+from bridgedb.distributors.email import request
from bridgedb.parse import addr
from bridgedb.parse.addr import UnsupportedDomain
from bridgedb.parse.addr import canonicalizeEmailDomain
@@ -109,7 +109,7 @@ class MailServerContext(object):
"""Create a context for storing configs for email bridge distribution.
:type config: :class:`bridgedb.persistent.Conf`
- :type distributor: :class:`~bridgedb.email.distributor.EmailDistributor`
+ :type distributor: :class:`~bridgedb.distributors.email.distributor.EmailDistributor`
:param distributor: The distributor will handle getting the correct
bridges (or none) for a client for us.
:type schedule: :class:`bridgedb.schedule.ScheduledInterval`
@@ -172,18 +172,18 @@ class SMTPMessage(object):
:var bool ignoring: If ``True``, we're ignoring the rest of this message
because it exceeded :data:`MailServerContext.maximumSize`.
:var canonicalFromSMTP: See
- :meth:`~bridgedb.email.autoresponder.SMTPAutoresponder.runChecks`.
+ :meth:`~bridgedb.distributors.email.autoresponder.SMTPAutoresponder.runChecks`.
:var canonicalFromEmail: See
- :meth:`~bridgedb.email.autoresponder.SMTPAutoresponder.runChecks`.
+ :meth:`~bridgedb.distributors.email.autoresponder.SMTPAutoresponder.runChecks`.
:var canonicalDomainRules: See
- :meth:`~bridgedb.email.autoresponder.SMTPAutoresponder.runChecks`.
+ :meth:`~bridgedb.distributors.email.autoresponder.SMTPAutoresponder.runChecks`.
:var message: (:api:`twisted.mail.smtp.rfc822.Message` or ``None``) The
incoming email message.
- :var responder: A :class:`~bridgedb.email.autoresponder.SMTPAutoresponder`
+ :var responder: A :class:`~bridgedb.distributors.email.autoresponder.SMTPAutoresponder`
which parses and checks the incoming :data:`message`. If it decides to
do so, it will build a
- :meth:`~bridgedb.email.autoresponder.SMTPAutoresponder.reply` email
- and :meth:`~bridgedb.email.autoresponder.SMTPAutoresponder.send` it.
+ :meth:`~bridgedb.distributors.email.autoresponder.SMTPAutoresponder.reply` email
+ and :meth:`~bridgedb.distributors.email.autoresponder.SMTPAutoresponder.send` it.
"""
implements(smtp.IMessage)
@@ -432,7 +432,7 @@ class SMTPIncomingServerFactory(smtp.SMTPFactory):
automation whenever we get a incoming connection on the SMTP port.
.. warning::
- My :attr:`~bridgedb.email.server.SMTPIncomingServerFactory.context`
+ My :attr:`~bridgedb.distributors.email.server.SMTPIncomingServerFactory.context`
isn't an OpenSSL context, as is used for the
:api:`twisted.mail.smtp.ESMTPSender`.
@@ -477,7 +477,7 @@ def addServer(config, distributor):
:type config: :class:`bridgedb.configure.Conf`
:param config: A configuration object.
- :type distributor: :class:`bridgedb.email.distributor.EmailDistributor`
+ :type distributor: :class:`bridgedb.distributors.email.distributor.EmailDistributor`
:param dist: A distributor which will handle database interactions, and
will decide which bridges to give to who and when.
"""
diff --git a/bridgedb/email/templates.py b/bridgedb/distributors/email/templates.py
similarity index 97%
rename from bridgedb/email/templates.py
rename to bridgedb/distributors/email/templates.py
index 014881e..85dd105 100644
--- a/bridgedb/email/templates.py
+++ b/bridgedb/distributors/email/templates.py
@@ -11,11 +11,11 @@
#_____________________________________________________________________________
"""
-.. py:module:: bridgedb.email.templates
+.. py:module:: bridgedb.distributors.email.templates
:synopsis: Templates for formatting emails sent out by the email
distributor.
-bridgedb.email.templates
+bridgedb.distributors.email.templates
========================
Templates for formatting emails sent out by the email distributor.
@@ -30,7 +30,7 @@ import os
from datetime import datetime
from bridgedb import strings
-from bridgedb.email.distributor import MAX_EMAIL_RATE
+from bridgedb.distributors.email.distributor import MAX_EMAIL_RATE
def addCommands(template):
diff --git a/bridgedb/https/__init__.py b/bridgedb/distributors/https/__init__.py
similarity index 52%
rename from bridgedb/https/__init__.py
rename to bridgedb/distributors/https/__init__.py
index f1210ec..6c51a5f 100644
--- a/bridgedb/https/__init__.py
+++ b/bridgedb/distributors/https/__init__.py
@@ -1 +1,5 @@
"""Servers for BridgeDB's HTTPS bridge distributor."""
+
+import distributor
+import request
+import server
diff --git a/bridgedb/https/distributor.py b/bridgedb/distributors/https/distributor.py
similarity index 98%
rename from bridgedb/https/distributor.py
rename to bridgedb/distributors/https/distributor.py
index 4e980b7..791229b 100644
--- a/bridgedb/https/distributor.py
+++ b/bridgedb/distributors/https/distributor.py
@@ -11,7 +11,7 @@
# :license: see LICENSE for licensing information
"""
-bridgedb.https.distributor
+bridgedb.distributors.https.distributor
==========================
A Distributor that hands out bridges through a web interface.
@@ -119,7 +119,7 @@ class HTTPSDistributor(Distributor):
``1.2.178.234``) are placed within the same cluster, but Carol (with
address ``1.3.11.33``) *might* end up in a different cluster.
- >>> from bridgedb.https.distributor import HTTPSDistributor
+ >>> from bridgedb.distributors.https.distributor import HTTPSDistributor
>>> HTTPSDistributor.getSubnet('1.2.3.4')
'1.2.0.0/16'
>>> HTTPSDistributor.getSubnet('1.2.211.154')
@@ -274,7 +274,7 @@ class HTTPSDistributor(Distributor):
def getBridges(self, bridgeRequest, interval):
"""Return a list of bridges to give to a user.
- :type bridgeRequest: :class:`bridgedb.https.request.HTTPSBridgeRequest`
+ :type bridgeRequest: :class:`bridgedb.distributors.https.request.HTTPSBridgeRequest`
:param bridgeRequest: A :class:`~bridgedb.bridgerequest.BridgeRequestBase`
with the :data:`~bridgedb.bridgerequest.BridgeRequestBase.client`
attribute set to a string containing the client's IP address.
@@ -283,7 +283,7 @@ class HTTPSDistributor(Distributor):
:rtype: list
:return: A list of :class:`~bridgedb.Bridges.Bridge`s to include in
the response. See
- :meth:`bridgedb.https.server.WebResourceBridges.getBridgeRequestAnswer`
+ :meth:`bridgedb.distributors.https.server.WebResourceBridges.getBridgeRequestAnswer`
for an example of how this is used.
"""
logging.info("Attempting to get bridges for %s..." % bridgeRequest.client)
diff --git a/bridgedb/https/request.py b/bridgedb/distributors/https/request.py
similarity index 96%
rename from bridgedb/https/request.py
rename to bridgedb/distributors/https/request.py
index fd80809..3236bee 100644
--- a/bridgedb/https/request.py
+++ b/bridgedb/distributors/https/request.py
@@ -10,11 +10,11 @@
#_____________________________________________________________________________
"""
-.. py:module:: bridgedb.https.request
+.. py:module:: bridgedb.distributors.https.request
:synopsis: Classes for parsing and storing information about requests for
bridges which are sent to the HTTPS distributor.
-bridgedb.https.request
+bridgedb.distributors.https.request
======================
Classes for parsing and storing information about requests for bridges
@@ -24,7 +24,7 @@ which are sent to the HTTPS distributor.
::
- bridgedb.https.request
+ bridgedb.distributors.https.request
|
|_ HTTPSBridgeRequest - A request for bridges which was received through
the HTTPS distributor.
@@ -58,7 +58,7 @@ class HTTPSBridgeRequest(bridgerequest.BridgeRequestBase):
def __init__(self, addClientCountryCode=True):
"""Process a new bridge request received through the
- :class:`~bridgedb.https.distributor.HTTPSDistributor`.
+ :class:`~bridgedb.distributors.https.distributor.HTTPSDistributor`.
:param bool addClientCountryCode: If ``True``, then calling
:meth:`withoutBlockInCountry` will attempt to add the client's own
diff --git a/bridgedb/https/server.py b/bridgedb/distributors/https/server.py
similarity index 99%
rename from bridgedb/https/server.py
rename to bridgedb/distributors/https/server.py
index c785450..3e4284f 100644
--- a/bridgedb/https/server.py
+++ b/bridgedb/distributors/https/server.py
@@ -8,11 +8,11 @@
# :license: see LICENSE for licensing information
"""
-.. py:module:: bridgedb.https.server
+.. py:module:: bridgedb.distributors.https.server
:synopsis: Servers which interface with clients and distribute bridges
over HTTP(S).
-bridgedb.https.server
+bridgedb.distributors.https.server
=====================
Servers which interface with clients and distribute bridges over HTTP(S).
@@ -50,7 +50,7 @@ from bridgedb import crypto
from bridgedb import strings
from bridgedb import translations
from bridgedb import txrecaptcha
-from bridgedb.https.request import HTTPSBridgeRequest
+from bridgedb.distributors.https.request import HTTPSBridgeRequest
from bridgedb.parse import headers
from bridgedb.parse.addr import isIPAddress
from bridgedb.qrcodes import generateQR
@@ -1032,7 +1032,7 @@ def addWebServer(config, distributor):
CSP_ENABLED
CSP_REPORT_ONLY
CSP_INCLUDE_SELF
- :type distributor: :class:`bridgedb.https.distributor.HTTPSDistributor`
+ :type distributor: :class:`bridgedb.distributors.https.distributor.HTTPSDistributor`
:param distributor: A bridge distributor.
:raises SystemExit: if the servers cannot be started.
:rtype: :api:`twisted.web.server.Site`
diff --git a/bridgedb/https/templates/assets/css/bootstrap.min.css b/bridgedb/distributors/https/templates/assets/css/bootstrap.min.css
similarity index 100%
rename from bridgedb/https/templates/assets/css/bootstrap.min.css
rename to bridgedb/distributors/https/templates/assets/css/bootstrap.min.css
diff --git a/bridgedb/https/templates/assets/css/error.css b/bridgedb/distributors/https/templates/assets/css/error.css
similarity index 100%
rename from bridgedb/https/templates/assets/css/error.css
rename to bridgedb/distributors/https/templates/assets/css/error.css
diff --git a/bridgedb/https/templates/assets/css/font-awesome-ie7.min.css b/bridgedb/distributors/https/templates/assets/css/font-awesome-ie7.min.css
similarity index 100%
rename from bridgedb/https/templates/assets/css/font-awesome-ie7.min.css
rename to bridgedb/distributors/https/templates/assets/css/font-awesome-ie7.min.css
diff --git a/bridgedb/https/templates/assets/css/font-awesome.min.css b/bridgedb/distributors/https/templates/assets/css/font-awesome.min.css
similarity index 100%
rename from bridgedb/https/templates/assets/css/font-awesome.min.css
rename to bridgedb/distributors/https/templates/assets/css/font-awesome.min.css
diff --git a/bridgedb/https/templates/assets/css/main.css b/bridgedb/distributors/https/templates/assets/css/main.css
similarity index 100%
rename from bridgedb/https/templates/assets/css/main.css
rename to bridgedb/distributors/https/templates/assets/css/main.css
diff --git a/bridgedb/https/templates/assets/css/rtl.css b/bridgedb/distributors/https/templates/assets/css/rtl.css
similarity index 100%
rename from bridgedb/https/templates/assets/css/rtl.css
rename to bridgedb/distributors/https/templates/assets/css/rtl.css
diff --git a/bridgedb/https/templates/assets/font/fontawesome-webfont.eot b/bridgedb/distributors/https/templates/assets/font/fontawesome-webfont.eot
similarity index 100%
rename from bridgedb/https/templates/assets/font/fontawesome-webfont.eot
rename to bridgedb/distributors/https/templates/assets/font/fontawesome-webfont.eot
diff --git a/bridgedb/https/templates/assets/font/fontawesome-webfont.svg b/bridgedb/distributors/https/templates/assets/font/fontawesome-webfont.svg
similarity index 100%
rename from bridgedb/https/templates/assets/font/fontawesome-webfont.svg
rename to bridgedb/distributors/https/templates/assets/font/fontawesome-webfont.svg
diff --git a/bridgedb/https/templates/assets/font/fontawesome-webfont.ttf b/bridgedb/distributors/https/templates/assets/font/fontawesome-webfont.ttf
similarity index 100%
rename from bridgedb/https/templates/assets/font/fontawesome-webfont.ttf
rename to bridgedb/distributors/https/templates/assets/font/fontawesome-webfont.ttf
diff --git a/bridgedb/https/templates/assets/font/fontawesome-webfont.woff b/bridgedb/distributors/https/templates/assets/font/fontawesome-webfont.woff
similarity index 100%
rename from bridgedb/https/templates/assets/font/fontawesome-webfont.woff
rename to bridgedb/distributors/https/templates/assets/font/fontawesome-webfont.woff
diff --git a/bridgedb/https/templates/assets/font/lato-bold.woff b/bridgedb/distributors/https/templates/assets/font/lato-bold.woff
similarity index 100%
rename from bridgedb/https/templates/assets/font/lato-bold.woff
rename to bridgedb/distributors/https/templates/assets/font/lato-bold.woff
diff --git a/bridgedb/https/templates/assets/font/lato-italic.woff b/bridgedb/distributors/https/templates/assets/font/lato-italic.woff
similarity index 100%
rename from bridgedb/https/templates/assets/font/lato-italic.woff
rename to bridgedb/distributors/https/templates/assets/font/lato-italic.woff
diff --git a/bridgedb/https/templates/assets/font/lato-regular.woff b/bridgedb/distributors/https/templates/assets/font/lato-regular.woff
similarity index 100%
rename from bridgedb/https/templates/assets/font/lato-regular.woff
rename to bridgedb/distributors/https/templates/assets/font/lato-regular.woff
diff --git a/bridgedb/https/templates/assets/images/404-excavator.svg b/bridgedb/distributors/https/templates/assets/images/404-excavator.svg
similarity index 100%
rename from bridgedb/https/templates/assets/images/404-excavator.svg
rename to bridgedb/distributors/https/templates/assets/images/404-excavator.svg
diff --git a/bridgedb/https/templates/assets/images/404-hills-left.svg b/bridgedb/distributors/https/templates/assets/images/404-hills-left.svg
similarity index 100%
rename from bridgedb/https/templates/assets/images/404-hills-left.svg
rename to bridgedb/distributors/https/templates/assets/images/404-hills-left.svg
diff --git a/bridgedb/https/templates/assets/images/404-hills-right.svg b/bridgedb/distributors/https/templates/assets/images/404-hills-right.svg
similarity index 100%
rename from bridgedb/https/templates/assets/images/404-hills-right.svg
rename to bridgedb/distributors/https/templates/assets/images/404-hills-right.svg
diff --git a/bridgedb/https/templates/assets/images/500-hills-left-shade.svg b/bridgedb/distributors/https/templates/assets/images/500-hills-left-shade.svg
similarity index 100%
rename from bridgedb/https/templates/assets/images/500-hills-left-shade.svg
rename to bridgedb/distributors/https/templates/assets/images/500-hills-left-shade.svg
diff --git a/bridgedb/https/templates/assets/images/500-hills-left.svg b/bridgedb/distributors/https/templates/assets/images/500-hills-left.svg
similarity index 100%
rename from bridgedb/https/templates/assets/images/500-hills-left.svg
rename to bridgedb/distributors/https/templates/assets/images/500-hills-left.svg
diff --git a/bridgedb/https/templates/assets/images/500-hills-right-shade.svg b/bridgedb/distributors/https/templates/assets/images/500-hills-right-shade.svg
similarity index 100%
rename from bridgedb/https/templates/assets/images/500-hills-right-shade.svg
rename to bridgedb/distributors/https/templates/assets/images/500-hills-right-shade.svg
diff --git a/bridgedb/https/templates/assets/images/500-hills-right.svg b/bridgedb/distributors/https/templates/assets/images/500-hills-right.svg
similarity index 100%
rename from bridgedb/https/templates/assets/images/500-hills-right.svg
rename to bridgedb/distributors/https/templates/assets/images/500-hills-right.svg
diff --git a/bridgedb/https/templates/assets/images/500-road.svg b/bridgedb/distributors/https/templates/assets/images/500-road.svg
similarity index 100%
rename from bridgedb/https/templates/assets/images/500-road.svg
rename to bridgedb/distributors/https/templates/assets/images/500-road.svg
diff --git a/bridgedb/https/templates/assets/images/maintenance-hills-left-shade.svg b/bridgedb/distributors/https/templates/assets/images/maintenance-hills-left-shade.svg
similarity index 100%
rename from bridgedb/https/templates/assets/images/maintenance-hills-left-shade.svg
rename to bridgedb/distributors/https/templates/assets/images/maintenance-hills-left-shade.svg
diff --git a/bridgedb/https/templates/assets/images/maintenance-hills-left.svg b/bridgedb/distributors/https/templates/assets/images/maintenance-hills-left.svg
similarity index 100%
rename from bridgedb/https/templates/assets/images/maintenance-hills-left.svg
rename to bridgedb/distributors/https/templates/assets/images/maintenance-hills-left.svg
diff --git a/bridgedb/https/templates/assets/images/maintenance-hills-right-shade.svg b/bridgedb/distributors/https/templates/assets/images/maintenance-hills-right-shade.svg
similarity index 100%
rename from bridgedb/https/templates/assets/images/maintenance-hills-right-shade.svg
rename to bridgedb/distributors/https/templates/assets/images/maintenance-hills-right-shade.svg
diff --git a/bridgedb/https/templates/assets/images/maintenance-hills-right.svg b/bridgedb/distributors/https/templates/assets/images/maintenance-hills-right.svg
similarity index 100%
rename from bridgedb/https/templates/assets/images/maintenance-hills-right.svg
rename to bridgedb/distributors/https/templates/assets/images/maintenance-hills-right.svg
diff --git a/bridgedb/https/templates/assets/images/maintenance-tractor.svg b/bridgedb/distributors/https/templates/assets/images/maintenance-tractor.svg
similarity index 100%
rename from bridgedb/https/templates/assets/images/maintenance-tractor.svg
rename to bridgedb/distributors/https/templates/assets/images/maintenance-tractor.svg
diff --git a/bridgedb/https/templates/assets/js/bridges.js b/bridgedb/distributors/https/templates/assets/js/bridges.js
similarity index 100%
rename from bridgedb/https/templates/assets/js/bridges.js
rename to bridgedb/distributors/https/templates/assets/js/bridges.js
diff --git a/bridgedb/https/templates/assets/tor-roots-blue.svg b/bridgedb/distributors/https/templates/assets/tor-roots-blue.svg
similarity index 100%
rename from bridgedb/https/templates/assets/tor-roots-blue.svg
rename to bridgedb/distributors/https/templates/assets/tor-roots-blue.svg
diff --git a/bridgedb/https/templates/assets/tor.svg b/bridgedb/distributors/https/templates/assets/tor.svg
similarity index 100%
rename from bridgedb/https/templates/assets/tor.svg
rename to bridgedb/distributors/https/templates/assets/tor.svg
diff --git a/bridgedb/https/templates/base.html b/bridgedb/distributors/https/templates/base.html
similarity index 100%
rename from bridgedb/https/templates/base.html
rename to bridgedb/distributors/https/templates/base.html
diff --git a/bridgedb/https/templates/bridges.html b/bridgedb/distributors/https/templates/bridges.html
similarity index 100%
rename from bridgedb/https/templates/bridges.html
rename to bridgedb/distributors/https/templates/bridges.html
diff --git a/bridgedb/https/templates/captcha.html b/bridgedb/distributors/https/templates/captcha.html
similarity index 100%
rename from bridgedb/https/templates/captcha.html
rename to bridgedb/distributors/https/templates/captcha.html
diff --git a/bridgedb/https/templates/error-404.html b/bridgedb/distributors/https/templates/error-404.html
similarity index 100%
rename from bridgedb/https/templates/error-404.html
rename to bridgedb/distributors/https/templates/error-404.html
diff --git a/bridgedb/https/templates/error-500.html b/bridgedb/distributors/https/templates/error-500.html
similarity index 100%
rename from bridgedb/https/templates/error-500.html
rename to bridgedb/distributors/https/templates/error-500.html
diff --git a/bridgedb/https/templates/error-503.html b/bridgedb/distributors/https/templates/error-503.html
similarity index 100%
rename from bridgedb/https/templates/error-503.html
rename to bridgedb/distributors/https/templates/error-503.html
diff --git a/bridgedb/https/templates/howto.html b/bridgedb/distributors/https/templates/howto.html
similarity index 100%
rename from bridgedb/https/templates/howto.html
rename to bridgedb/distributors/https/templates/howto.html
diff --git a/bridgedb/https/templates/index.html b/bridgedb/distributors/https/templates/index.html
similarity index 100%
rename from bridgedb/https/templates/index.html
rename to bridgedb/distributors/https/templates/index.html
diff --git a/bridgedb/https/templates/options.html b/bridgedb/distributors/https/templates/options.html
similarity index 100%
rename from bridgedb/https/templates/options.html
rename to bridgedb/distributors/https/templates/options.html
diff --git a/bridgedb/https/templates/robots.txt b/bridgedb/distributors/https/templates/robots.txt
similarity index 100%
rename from bridgedb/https/templates/robots.txt
rename to bridgedb/distributors/https/templates/robots.txt
diff --git a/bridgedb/email/__init__.py b/bridgedb/email/__init__.py
deleted file mode 100644
index 604c648..0000000
--- a/bridgedb/email/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-"""Servers for BridgeDB's email bridge distributor."""
diff --git a/bridgedb/parse/addr.py b/bridgedb/parse/addr.py
index cd512d1..bf5a8a5 100644
--- a/bridgedb/parse/addr.py
+++ b/bridgedb/parse/addr.py
@@ -217,7 +217,7 @@ def canonicalizeEmailDomain(domain, domainmap):
:param str domain: The domain portion of an email address to validate. It
will be checked that it is one of the domains allowed to email
requests for bridges to the
- :class:`~bridgedb.email.distributor.EmailDistributor`.
+ :class:`~bridgedb.distributors.email.distributor.EmailDistributor`.
:param dict domainmap: A map of permitted alternate domains (in lowercase)
to their canonical domain names (in lowercase). This can be configured
with the ``EMAIL_DOMAIN_MAP`` option in ``bridgedb.conf``, for
@@ -442,7 +442,7 @@ def normalizeEmail(emailaddr, domainmap, domainrules, ignorePlus=True):
The email address, **emailaddr**, will be parsed and validated, and then
checked that it originated from one of the domains allowed to email
requests for bridges to the
- :class:`~bridgedb.email.distributor.EmailDistributor` via the
+ :class:`~bridgedb.distributors.email.distributor.EmailDistributor` via the
:func:`canonicaliseEmailDomain` function.
:param str emailaddr: An email address to normalise.
diff --git a/bridgedb/persistent.py b/bridgedb/persistent.py
index 4410b9b..c46c4a5 100644
--- a/bridgedb/persistent.py
+++ b/bridgedb/persistent.py
@@ -25,8 +25,8 @@ from twisted.spread import jelly
from bridgedb import Bridges
from bridgedb import filters
-from bridgedb.email import distributor as emailDistributor
-from bridgedb.https import distributor as httpsDistributor
+from bridgedb.distributors.email import distributor as emailDistributor
+from bridgedb.distributors.https import distributor as httpsDistributor
from bridgedb.configure import Conf
#from bridgedb.proxy import ProxySet
diff --git a/bridgedb/strings.py b/bridgedb/strings.py
index 7d4b99e..1c40695 100644
--- a/bridgedb/strings.py
+++ b/bridgedb/strings.py
@@ -92,7 +92,7 @@ help to circumvent internet censorship in many cases.\n\n"""),
}
"""These strings should go on the first "Welcome" email sent by the
:mod:`~bridgedb.EmailServer`, as well as on the ``index.html`` template used
-by the :mod:`~bridgedb.https.server`. They are used as an introduction to
+by the :mod:`~bridgedb.distributors.https.server`. They are used as an introduction to
explain what Tor bridges are, what bridges do, and why someone might want to
use bridges.
"""
@@ -278,7 +278,7 @@ contain format specifiers (i.e. ``%s``) to what those format specifiers should
be replaced with in a given template system.
For example, a string which needs a pair of HTML ``("<a href=''">, "</a>")``
-tags (for the templates used by :mod:`bridgedb.https.server`) would need some
+tags (for the templates used by :mod:`bridgedb.distributors.https.server`) would need some
alternative replacements for the :mod:`EmailServer`, because the latter uses
templates with a ``text/plain`` mimetype instead of HTML. For the
``EmailServer``, the format strings specifiers are replaced with an empty
diff --git a/bridgedb/test/email_helpers.py b/bridgedb/test/email_helpers.py
index 55b8033..645fc93 100644
--- a/bridgedb/test/email_helpers.py
+++ b/bridgedb/test/email_helpers.py
@@ -14,9 +14,9 @@
import io
from bridgedb.persistent import Conf
-from bridgedb.email.distributor import IgnoreEmail
-from bridgedb.email.distributor import TooSoonEmail
-from bridgedb.email.server import MailServerContext
+from bridgedb.distributors.email.distributor import IgnoreEmail
+from bridgedb.distributors.email.distributor import TooSoonEmail
+from bridgedb.distributors.email.server import MailServerContext
from bridgedb.schedule import Unscheduled
from . import util
@@ -121,7 +121,7 @@ def _createMailServerContext(config=None, distributor=None):
class DummyEmailDistributor(object):
- """A mocked :class:`bridgedb.email.distributor.EmailDistributor` which is used
+ """A mocked :class:`bridgedb.distributors.email.distributor.EmailDistributor` which is used
to test :class:`bridgedb.EmailServer`.
"""
@@ -145,9 +145,9 @@ class DummyEmailDistributor(object):
class DummyEmailDistributorWithState(DummyEmailDistributor):
- """A mocked :class:`bridgedb.email.distributor.EmailDistributor` which raises
- :exc:`bridgedb.email.distributor.TooSoonEmail` on the second email and
- :exc:`bridgedb.email.distributor.IgnoreEmail` on the third.
+ """A mocked :class:`bridgedb.distributors.email.distributor.EmailDistributor` which raises
+ :exc:`bridgedb.distributors.email.distributor.TooSoonEmail` on the second email and
+ :exc:`bridgedb.distributors.email.distributor.IgnoreEmail` on the third.
Note that the state tracking is done in a really dumb way. For example, we
currently don't consider requests for help text or GnuPG keys to be a
diff --git a/bridgedb/test/https_helpers.py b/bridgedb/test/https_helpers.py
index 5c1c838..d54e544 100644
--- a/bridgedb/test/https_helpers.py
+++ b/bridgedb/test/https_helpers.py
@@ -113,8 +113,8 @@ def _createConfig(configFile=TEST_CONFIG_FILE):
class DummyHTTPSDistributor(object):
- """A mocked :class:`bridgedb.https.distributor.HTTPSDistributor` which is
- used to test :class:`bridgedb.https.server.BridgesResource`.
+ """A mocked :class:`bridgedb.distributors.https.distributor.HTTPSDistributor` which is
+ used to test :class:`bridgedb.distributors.https.server.BridgesResource`.
"""
_bridge_class = util.DummyBridge
_bridgesPerResponseMin = 3
diff --git a/bridgedb/test/legacy_Tests.py b/bridgedb/test/legacy_Tests.py
index 22b2e13..77409b4 100644
--- a/bridgedb/test/legacy_Tests.py
+++ b/bridgedb/test/legacy_Tests.py
@@ -26,9 +26,9 @@ import ipaddr
from bridgedb.Stability import BridgeHistory
-from bridgedb.email.distributor import EmailDistributor
-from bridgedb.email.distributor import IgnoreEmail
-from bridgedb.email.distributor import TooSoonEmail
+from bridgedb.distributors.email.distributor import EmailDistributor
+from bridgedb.distributors.email.distributor import IgnoreEmail
+from bridgedb.distributors.email.distributor import TooSoonEmail
from bridgedb.parse import addr
from .util import bracketIPv6
diff --git a/bridgedb/test/test_email_autoresponder.py b/bridgedb/test/test_email_autoresponder.py
index 6bdac9e..a1e376f 100644
--- a/bridgedb/test/test_email_autoresponder.py
+++ b/bridgedb/test/test_email_autoresponder.py
@@ -9,7 +9,7 @@
# (c) 2007-2013, all entities within the AUTHORS file
# :license: 3-Clause BSD, see LICENSE for licensing information
-"""Unittests for the :mod:`bridgedb.email.autoresponder` module."""
+"""Unittests for the :mod:`bridgedb.distributors.email.autoresponder` module."""
from __future__ import print_function
@@ -23,9 +23,9 @@ from twisted.python.failure import Failure
from twisted.trial import unittest
from twisted.test import proto_helpers
-from bridgedb.email import autoresponder
-from bridgedb.email.server import SMTPMessage
-from bridgedb.email.distributor import TooSoonEmail
+from bridgedb.distributors.email import autoresponder
+from bridgedb.distributors.email.server import SMTPMessage
+from bridgedb.distributors.email.distributor import TooSoonEmail
from bridgedb.test.email_helpers import _createConfig
from bridgedb.test.email_helpers import _createMailServerContext
@@ -33,7 +33,7 @@ from bridgedb.test.email_helpers import DummyEmailDistributorWithState
class CreateResponseBodyTests(unittest.TestCase):
- """Tests for :func:`bridgedb.email.autoresponder.createResponseBody`."""
+ """Tests for :func:`bridgedb.distributors.email.autoresponder.createResponseBody`."""
def _moveGPGTestKeyfile(self):
here = os.getcwd()
@@ -289,7 +289,7 @@ a ball of timey-wimey, wibbly-warbly... stuff."""
class SMTPAutoresponderTests(unittest.TestCase):
- """Unittests for :class:`bridgedb.email.autoresponder.SMTPAutoresponder`."""
+ """Unittests for :class:`bridgedb.distributors.email.autoresponder.SMTPAutoresponder`."""
timeout = 10
@@ -322,7 +322,7 @@ class SMTPAutoresponderTests(unittest.TestCase):
self.responder = self.message.responder
# The following are needed to provide client disconnection methods for
# the call to ``twisted.mail.smtp.SMTPClient.sendError`` in
- # ``bridgedb.email.autoresponder.SMTPAutoresponder.sendError``:
+ # ``bridgedb.distributors.email.autoresponder.SMTPAutoresponder.sendError``:
#protocol = proto_helpers.AccumulatingProtocol()
#transport = proto_helpers.StringTransportWithDisconnection()
self.tr = proto_helpers.StringTransportWithDisconnection()
diff --git a/bridgedb/test/test_email_distributor.py b/bridgedb/test/test_email_distributor.py
index 0d727b8..d95370f 100644
--- a/bridgedb/test/test_email_distributor.py
+++ b/bridgedb/test/test_email_distributor.py
@@ -7,7 +7,7 @@
# (c) 2007-2017, The Tor Project, Inc.
# :license: see included LICENSE for information
-"""Tests for :mod:`bridgedb.email.distributor`."""
+"""Tests for :mod:`bridgedb.distributors.email.distributor`."""
from __future__ import print_function
@@ -21,10 +21,10 @@ from twisted.trial import unittest
import bridgedb.Storage
from bridgedb.bridges import Bridge
-from bridgedb.email.distributor import EmailDistributor
-from bridgedb.email.distributor import IgnoreEmail
-from bridgedb.email.distributor import TooSoonEmail
-from bridgedb.email.request import EmailBridgeRequest
+from bridgedb.distributors.email.distributor import EmailDistributor
+from bridgedb.distributors.email.distributor import IgnoreEmail
+from bridgedb.distributors.email.distributor import TooSoonEmail
+from bridgedb.distributors.email.request import EmailBridgeRequest
from bridgedb.parse.addr import BadEmail
from bridgedb.parse.addr import UnsupportedDomain
from bridgedb.parse.addr import normalizeEmail
@@ -38,7 +38,7 @@ BRIDGES = generateFakeBridges()
class EmailDistributorTests(unittest.TestCase):
- """Tests for :class:`bridgedb.email.distributor.EmailDistributor`."""
+ """Tests for :class:`bridgedb.distributors.email.distributor.EmailDistributor`."""
# Fail any tests which take longer than 15 seconds.
timeout = 15
diff --git a/bridgedb/test/test_email_dkim.py b/bridgedb/test/test_email_dkim.py
index 499a3c1..dc4c53b 100644
--- a/bridgedb/test/test_email_dkim.py
+++ b/bridgedb/test/test_email_dkim.py
@@ -9,14 +9,14 @@
# (c) 2007-2013, all entities within the AUTHORS file
# :license: 3-Clause BSD, see LICENSE for licensing information
-"""Unittests for the :mod:`bridgedb.email.dkim` module."""
+"""Unittests for the :mod:`bridgedb.distributors.email.dkim` module."""
import io
from twisted.mail.smtp import rfc822
from twisted.trial import unittest
-from bridgedb.email import dkim
+from bridgedb.distributors.email import dkim
class CheckDKIMTests(unittest.TestCase):
diff --git a/bridgedb/test/test_email_request.py b/bridgedb/test/test_email_request.py
index 745ea71..0c87d36 100644
--- a/bridgedb/test/test_email_request.py
+++ b/bridgedb/test/test_email_request.py
@@ -9,7 +9,7 @@
# (c) 2007-2013, all entities within the AUTHORS file
# :license: 3-Clause BSD, see LICENSE for licensing information
-"""Unittests for the :mod:`bridgedb.email.request` module."""
+"""Unittests for the :mod:`bridgedb.distributors.email.request` module."""
from __future__ import print_function
@@ -17,7 +17,7 @@ import ipaddr
from twisted.trial import unittest
-from bridgedb.email import request
+from bridgedb.distributors.email import request
class DetermineBridgeRequestOptionsTests(unittest.TestCase):
diff --git a/bridgedb/test/test_email_server.py b/bridgedb/test/test_email_server.py
index 946133c..edf2539 100644
--- a/bridgedb/test/test_email_server.py
+++ b/bridgedb/test/test_email_server.py
@@ -9,7 +9,7 @@
# (c) 2007-2013, all entities within the AUTHORS file
# :license: 3-Clause BSD, see LICENSE for licensing information
-"""Unittests for the :mod:`bridgedb.email.server` module."""
+"""Unittests for the :mod:`bridgedb.distributors.email.server` module."""
from __future__ import print_function
@@ -31,9 +31,9 @@ from twisted.trial import unittest
from zope.interface import implementedBy
-from bridgedb.email import server
-from bridgedb.email.distributor import EmailDistributor
-from bridgedb.email.distributor import TooSoonEmail
+from bridgedb.distributors.email import server
+from bridgedb.distributors.email.distributor import EmailDistributor
+from bridgedb.distributors.email.distributor import TooSoonEmail
from bridgedb.parse.addr import BadEmail
from bridgedb.schedule import Unscheduled
@@ -43,7 +43,7 @@ from bridgedb.test.email_helpers import _createMailServerContext
class SMTPMessageTests(unittest.TestCase):
- """Unittests for :class:`bridgedb.email.server.SMTPMessage`."""
+ """Unittests for :class:`bridgedb.distributors.email.server.SMTPMessage`."""
def setUp(self):
self.config = _createConfig()
@@ -59,7 +59,7 @@ class SMTPMessageTests(unittest.TestCase):
def test_SMTPMessage_init(self):
"""Our ``message`` attribute should be a ``SMTPMessage`` object, and
``message.responder`` should be a
- :class:`bridgedb.email.autoresponder.SMTPAutoresponder`.
+ :class:`bridgedb.distributors.email.autoresponder.SMTPAutoresponder`.
"""
self.assertIsInstance(self.message, server.SMTPMessage)
self.assertIsInstance(self.message.responder,
@@ -320,7 +320,7 @@ class SMTPTestCaseMixin(util.TestCaseMixin):
segment. Includes the SMTP DATA EOM command ('.') at the end. If no
keyword arguments are given, the defaults are fairly sane.
- Suitable for testing a :class:`bridgedb.email.server.SMTPIncomingServerFactory`.
+ Suitable for testing a :class:`bridgedb.distributors.email.server.SMTPIncomingServerFactory`.
:param str fromAddr: An email address for the 'From:' header.
:param str toAddr: An email address for the 'To:' header.
@@ -382,7 +382,7 @@ class SMTPTestCaseMixin(util.TestCaseMixin):
class SMTPIncomingServerFactoryTests(SMTPTestCaseMixin, unittest.TestCase):
- """Unittests for :class:`bridgedb.email.server.SMTPIncomingServerFactory`."""
+ """Unittests for :class:`bridgedb.distributors.email.server.SMTPIncomingServerFactory`."""
def setUp(self):
"""Set up a localhost SMTPIncomingServerFactory handler incoming SMTP
@@ -502,7 +502,7 @@ class SMTPIncomingServerFactoryTests(SMTPTestCaseMixin, unittest.TestCase):
class EmailServerServiceTests(SMTPTestCaseMixin, unittest.TestCase):
- """Unittests for :func:`bridgedb.email.server.addServer`."""
+ """Unittests for :func:`bridgedb.distributors.email.server.addServer`."""
def setUp(self):
"""Create a MailServerContext and EmailDistributor."""
@@ -523,7 +523,7 @@ class EmailServerServiceTests(SMTPTestCaseMixin, unittest.TestCase):
reactor.runUntilCurrent()
def test_addServer(self):
- """Call :func:`bridgedb.email.server.addServer` to test startup."""
+ """Call :func:`bridgedb.distributors.email.server.addServer` to test startup."""
factory = server.addServer(self.config, self.dist)
factory.timeout = None
factory.protocol.timeout = None # Or else the reactor gets dirty
diff --git a/bridgedb/test/test_email_templates.py b/bridgedb/test/test_email_templates.py
index 0c74377..8464fe9 100644
--- a/bridgedb/test/test_email_templates.py
+++ b/bridgedb/test/test_email_templates.py
@@ -9,7 +9,7 @@
# (c) 2007-2013, all entities within the AUTHORS file
# :license: 3-Clause BSD, see LICENSE for licensing information
-"""Unittests for the :mod:`bridgedb.email.templates` module."""
+"""Unittests for the :mod:`bridgedb.distributors.email.templates` module."""
from __future__ import print_function
from __future__ import unicode_literals
@@ -20,7 +20,7 @@ from gettext import NullTranslations
from twisted.mail.smtp import Address
from twisted.trial import unittest
-from bridgedb.email import templates
+from bridgedb.distributors.email import templates
class EmailTemplatesTests(unittest.TestCase):
diff --git a/bridgedb/test/test_https_distributor.py b/bridgedb/test/test_https_distributor.py
index 0d20960..791a940 100644
--- a/bridgedb/test/test_https_distributor.py
+++ b/bridgedb/test/test_https_distributor.py
@@ -9,7 +9,7 @@
# (c) 2007-2017, all entities within the AUTHORS file
# :license: 3-clause BSD, see included LICENSE for information
-"""Tests for :mod:`bridgedb.https.distributor`."""
+"""Tests for :mod:`bridgedb.distributors.https.distributor`."""
from __future__ import print_function
@@ -23,8 +23,8 @@ from bridgedb.Bridges import BridgeRing
from bridgedb.Bridges import BridgeRingParameters
from bridgedb.filters import byIPv4
from bridgedb.filters import byIPv6
-from bridgedb.https import distributor
-from bridgedb.https.request import HTTPSBridgeRequest
+from bridgedb.distributors.https import distributor
+from bridgedb.distributors.https.request import HTTPSBridgeRequest
from bridgedb.proxy import ProxySet
from bridgedb.test.util import randomValidIPv4String
diff --git a/bridgedb/test/test_https_request.py b/bridgedb/test/test_https_request.py
index c262aef..2ea3fe6 100644
--- a/bridgedb/test/test_https_request.py
+++ b/bridgedb/test/test_https_request.py
@@ -14,7 +14,7 @@
from twisted.trial import unittest
from bridgedb.bridgerequest import IRequestBridges
-from bridgedb.https import request
+from bridgedb.distributors.https import request
class MockRequest(object):
@@ -23,7 +23,7 @@ class MockRequest(object):
class HTTPSBridgeRequestTests(unittest.TestCase):
- """Unittests for :class:`bridgedb.https.request.HTTPSBridgeRequest`."""
+ """Unittests for :class:`bridgedb.distributors.https.request.HTTPSBridgeRequest`."""
def setUp(self):
"""Setup test run."""
diff --git a/bridgedb/test/test_https_server.py b/bridgedb/test/test_https_server.py
index 3827bfe..2c41359 100644
--- a/bridgedb/test/test_https_server.py
+++ b/bridgedb/test/test_https_server.py
@@ -9,7 +9,7 @@
# :license: see LICENSE for licensing information
#_____________________________________________________________________________
-"""Unittests for :mod:`bridgedb.https.server`."""
+"""Unittests for :mod:`bridgedb.distributors.https.server`."""
from __future__ import print_function
@@ -27,7 +27,7 @@ from twisted.trial import unittest
from twisted.web.resource import Resource
from twisted.web.test import requesthelper
-from bridgedb.https import server
+from bridgedb.distributors.https import server
from bridgedb.schedule import ScheduledInterval
from bridgedb.test.https_helpers import _createConfig
@@ -44,8 +44,8 @@ logging.disable(50)
class SetFQDNTests(unittest.TestCase):
- """Tests for :func:`bridgedb.https.server.setFQDN` and
- :func:`bridgedb.https.server.setFQDN`.
+ """Tests for :func:`bridgedb.distributors.https.server.setFQDN` and
+ :func:`bridgedb.distributors.https.server.setFQDN`.
"""
def setUp(self):
@@ -72,7 +72,7 @@ class SetFQDNTests(unittest.TestCase):
class GetClientIPTests(unittest.TestCase):
- """Tests for :func:`bridgedb.https.server.getClientIP`."""
+ """Tests for :func:`bridgedb.distributors.https.server.getClientIP`."""
def createRequestWithIPs(self):
"""Set the IP address returned from ``request.getClientIP()`` to
@@ -114,7 +114,7 @@ class GetClientIPTests(unittest.TestCase):
class ReplaceErrorPageTests(unittest.TestCase):
- """Tests for :func:`bridgedb.https.server.replaceErrorPage`."""
+ """Tests for :func:`bridgedb.distributors.https.server.replaceErrorPage`."""
def setUp(self):
self.resource500 = server.resource500
@@ -152,7 +152,7 @@ class ReplaceErrorPageTests(unittest.TestCase):
errorPage)
class ErrorResourceTests(unittest.TestCase):
- """Tests for :class:`bridgedb.https.server.ErrorResource`."""
+ """Tests for :class:`bridgedb.distributors.https.server.ErrorResource`."""
def setUp(self):
self.request = DummyRequest([''])
@@ -174,7 +174,7 @@ class ErrorResourceTests(unittest.TestCase):
class CustomErrorHandlingResourceTests(unittest.TestCase):
- """Tests for :class:`bridgedb.https.server.CustomErrorHandlingResource`."""
+ """Tests for :class:`bridgedb.distributors.https.server.CustomErrorHandlingResource`."""
def test_getChild(self):
"""``CustomErrorHandlingResource.getChild`` should return a rendered
@@ -258,7 +258,7 @@ class CSPResourceTests(unittest.TestCase):
class IndexResourceTests(unittest.TestCase):
- """Test for :class:`bridgedb.https.server.IndexResource`."""
+ """Test for :class:`bridgedb.distributors.https.server.IndexResource`."""
def setUp(self):
self.pagename = ''
@@ -283,7 +283,7 @@ class IndexResourceTests(unittest.TestCase):
class HowtoResourceTests(unittest.TestCase):
- """Test for :class:`bridgedb.https.server.HowtoResource`."""
+ """Test for :class:`bridgedb.distributors.https.server.HowtoResource`."""
def setUp(self):
self.pagename = 'howto.html'
@@ -308,7 +308,7 @@ class HowtoResourceTests(unittest.TestCase):
class CaptchaProtectedResourceTests(unittest.TestCase):
- """Tests for :class:`bridgedb.https.server.CaptchaProtectedResource`."""
+ """Tests for :class:`bridgedb.distributors.https.server.CaptchaProtectedResource`."""
def setUp(self):
self.dist = None
@@ -391,7 +391,7 @@ class CaptchaProtectedResourceTests(unittest.TestCase):
class GimpCaptchaProtectedResourceTests(unittest.TestCase):
- """Tests for :mod:`bridgedb.https.server.GimpCaptchaProtectedResource`."""
+ """Tests for :mod:`bridgedb.distributors.https.server.GimpCaptchaProtectedResource`."""
def setUp(self):
"""Create a :class:`server.BridgesResource` and protect it with
@@ -518,7 +518,7 @@ class GimpCaptchaProtectedResourceTests(unittest.TestCase):
class ReCaptchaProtectedResourceTests(unittest.TestCase):
- """Tests for :mod:`bridgedb.https.server.ReCaptchaProtectedResource`."""
+ """Tests for :mod:`bridgedb.distributors.https.server.ReCaptchaProtectedResource`."""
def setUp(self):
"""Create a :class:`server.BridgesResource` and protect it with
@@ -947,7 +947,7 @@ class BridgesResourceTests(unittest.TestCase):
class OptionsResourceTests(unittest.TestCase):
- """Tests for :class:`bridgedb.https.server.OptionsResource`."""
+ """Tests for :class:`bridgedb.distributors.https.server.OptionsResource`."""
def setUp(self):
"""Create a :class:`server.OptionsResource`."""
@@ -973,7 +973,7 @@ class OptionsResourceTests(unittest.TestCase):
class HTTPSServerServiceTests(unittest.TestCase):
- """Unittests for :func:`bridgedb.email.server.addWebServer`."""
+ """Unittests for :func:`bridgedb.distributors.email.server.addWebServer`."""
def setUp(self):
"""Create a config and an HTTPSDistributor."""
@@ -998,29 +998,29 @@ class HTTPSServerServiceTests(unittest.TestCase):
reactor.runUntilCurrent()
def test_addWebServer_GIMP_CAPTCHA_ENABLED(self):
- """Call :func:`bridgedb.https.server.addWebServer` to test startup."""
+ """Call :func:`bridgedb.distributors.https.server.addWebServer` to test startup."""
server.addWebServer(self.config, self.distributor)
def test_addWebServer_RECAPTCHA_ENABLED(self):
- """Call :func:`bridgedb.https.server.addWebServer` to test startup."""
+ """Call :func:`bridgedb.distributors.https.server.addWebServer` to test startup."""
config = self.config
config.RECAPTCHA_ENABLED = True
server.addWebServer(config, self.distributor)
def test_addWebServer_no_captchas(self):
- """Call :func:`bridgedb.https.server.addWebServer` to test startup."""
+ """Call :func:`bridgedb.distributors.https.server.addWebServer` to test startup."""
config = self.config
config.GIMP_CAPTCHA_ENABLED = False
server.addWebServer(config, self.distributor)
def test_addWebServer_no_HTTPS_ROTATION_PERIOD(self):
- """Call :func:`bridgedb.https.server.addWebServer` to test startup."""
+ """Call :func:`bridgedb.distributors.https.server.addWebServer` to test startup."""
config = self.config
config.HTTPS_ROTATION_PERIOD = None
server.addWebServer(config, self.distributor)
def test_addWebServer_CSP_ENABLED_False(self):
- """Call :func:`bridgedb.https.server.addWebServer` with
+ """Call :func:`bridgedb.distributors.https.server.addWebServer` with
``CSP_ENABLED=False`` to test startup.
"""
config = self.config
@@ -1028,7 +1028,7 @@ class HTTPSServerServiceTests(unittest.TestCase):
server.addWebServer(config, self.distributor)
def test_addWebServer_CSP_REPORT_ONLY_False(self):
- """Call :func:`bridgedb.https.server.addWebServer` with
+ """Call :func:`bridgedb.distributors.https.server.addWebServer` with
``CSP_REPORT_ONLY=False`` to test startup.
"""
config = self.config
@@ -1036,7 +1036,7 @@ class HTTPSServerServiceTests(unittest.TestCase):
server.addWebServer(config, self.distributor)
def test_addWebServer_CSP_INCLUDE_SELF_False(self):
- """Call :func:`bridgedb.https.server.addWebServer` with
+ """Call :func:`bridgedb.distributors.https.server.addWebServer` with
``CSP_INCLUDE_SELF=False`` to test startup.
"""
config = self.config
diff --git a/doc/sphinx/source/conf.py b/doc/sphinx/source/conf.py
index f1f5fa4..906d5fe 100644
--- a/doc/sphinx/source/conf.py
+++ b/doc/sphinx/source/conf.py
@@ -34,19 +34,19 @@ import bridgedb.Bridges
import bridgedb.Bucket
import bridgedb.crypto
import bridgedb.distribute
-import bridgedb.email
-import bridgedb.email.autoresponder
-import bridgedb.email.distributor
-import bridgedb.email.dkim
-import bridgedb.email.request
-import bridgedb.email.server
-import bridgedb.email.templates
+import bridgedb.distributors.email
+import bridgedb.distributors.email.autoresponder
+import bridgedb.distributors.email.distributor
+import bridgedb.distributors.email.dkim
+import bridgedb.distributors.email.request
+import bridgedb.distributors.email.server
+import bridgedb.distributors.email.templates
import bridgedb.filters
import bridgedb.geo
-import bridgedb.https
-import bridgedb.https.distributor
-import bridgedb.https.request
-import bridgedb.https.server
+import bridgedb.distributors.https
+import bridgedb.distributors.https.distributor
+import bridgedb.distributors.https.request
+import bridgedb.distributors.https.server
import bridgedb.Main
import bridgedb.parse
import bridgedb.parse.addr
diff --git a/setup.py b/setup.py
index 955a720..a133424 100644
--- a/setup.py
+++ b/setup.py
@@ -44,7 +44,7 @@ repo_langs = os.path.join(pkgpath, '_langs.py')
# The directory containing template files and other resources to serve on the
# web server:
-repo_templates = os.path.join(pkgpath, 'https', 'templates')
+repo_templates = os.path.join(pkgpath, 'distributors', 'https', 'templates')
# The directories to install non-sourcecode resources into should always be
# given as relative paths, in order to force distutils to install relative to
@@ -375,8 +375,9 @@ setuptools.setup(
download_url='https://gitweb.torproject.org/bridgedb.git',
package_dir={'bridgedb': 'bridgedb'},
packages=['bridgedb',
- 'bridgedb.email',
- 'bridgedb.https',
+ 'bridgedb.distributors',
+ 'bridgedb.distributors.email',
+ 'bridgedb.distributors.https',
'bridgedb.parse',
'bridgedb.test',
],
@@ -395,7 +396,7 @@ setuptools.setup(
message_extractors={
pkgpath: [
('**.py', 'python', None),
- ('https/templates/**.html', 'mako', None),
+ ('distributors/https/templates/**.html', 'mako', None),
]
},
)
1
0
commit 985923c9fa58a268fd8679f9e0193dd9411c8e59
Author: Isis Lovecruft <isis(a)torproject.org>
Date: Wed Nov 1 22:58:39 2017 +0000
Move bridgedb.Main to bridgedb.main.
---
bridgedb/configure.py | 4 +-
bridgedb/distributors/https/server.py | 2 +-
bridgedb/{Main.py => main.py} | 4 +-
bridgedb/proxy.py | 2 +-
bridgedb/runner.py | 2 +-
bridgedb/test/legacy_Tests.py | 2 +-
.../{test_bridgedb.py => test_bridgedb_script.py} | 0
bridgedb/test/{test_Main.py => test_main.py} | 126 ++++++++++-----------
.../{bridgedb.Main.rst => bridgedb.main.rst} | 6 +-
doc/sphinx/source/conf.py | 2 +-
scripts/bridgedb | 2 +-
11 files changed, 76 insertions(+), 76 deletions(-)
diff --git a/bridgedb/configure.py b/bridgedb/configure.py
index 02eea65..1a5e949 100644
--- a/bridgedb/configure.py
+++ b/bridgedb/configure.py
@@ -47,9 +47,9 @@ def loadConfig(configFile=None, configCls=None):
.. _faster: http://lucumr.pocoo.org/2011/2/1/exec-in-python/
:ivar bool itsSafeToUseLogging: This is called in
- :func:`bridgedb.Main.run` before
+ :func:`bridgedb.main.run` before
:func:`bridgedb.safelog.configureLogging`. When called from
- :func:`~bridgedb.Main.run`, the **configCls** parameter is not given,
+ :func:`~bridgedb.main.run`, the **configCls** parameter is not given,
because that is the first time that a
:class:`config <bridgedb.configure.Conf>` has been created. If a
:class:`logging.Logger` is created in this function, then logging will
diff --git a/bridgedb/distributors/https/server.py b/bridgedb/distributors/https/server.py
index 85a32b3..b756659 100644
--- a/bridgedb/distributors/https/server.py
+++ b/bridgedb/distributors/https/server.py
@@ -1008,7 +1008,7 @@ def addWebServer(config, distributor):
:type config: :class:`bridgedb.persistent.Conf`
:param config: A configuration object from
- :mod:`bridgedb.Main`. Currently, we use these options::
+ :mod:`bridgedb.main`. Currently, we use these options::
HTTP_UNENCRYPTED_PORT
HTTP_UNENCRYPTED_BIND_IP
HTTP_USE_IP_FROM_FORWARDED_HEADER
diff --git a/bridgedb/Main.py b/bridgedb/main.py
similarity index 99%
rename from bridgedb/Main.py
rename to bridgedb/main.py
index edd93cf..f6d16ec 100644
--- a/bridgedb/Main.py
+++ b/bridgedb/main.py
@@ -63,7 +63,7 @@ def load(state, hashring, clear=False):
hashring before parsing for new ones.
"""
if not state:
- logging.fatal("bridgedb.Main.load() could not retrieve state!")
+ logging.fatal("bridgedb.main.load() could not retrieve state!")
sys.exit(2)
if clear:
@@ -517,7 +517,7 @@ def runSubcommand(options, config):
:type options: :class:`bridgedb.opt.MainOptions`
:param options: A pre-parsed options class containing any arguments and
options given in the commandline we were called with.
- :type config: :class:`bridgedb.Main.Conf`
+ :type config: :class:`bridgedb.main.Conf`
:param config: The current configuration.
:raises: :exc:`SystemExit` when all subCommands and subOptions have
finished running.
diff --git a/bridgedb/proxy.py b/bridgedb/proxy.py
index 4611cf7..39cd109 100644
--- a/bridgedb/proxy.py
+++ b/bridgedb/proxy.py
@@ -33,7 +33,7 @@ def downloadTorExits(proxyList, ipaddress, port=443, protocol=None):
"""Run a script which downloads a list of Tor exit relays which allow their
clients to exit to the given **ipaddress** and **port**.
- :param proxyList: The :class:`ProxySet` instance from :mod:`bridgedb.Main`.
+ :param proxyList: The :class:`ProxySet` instance from :mod:`bridgedb.main`.
:param str ipaddress: The IP address that each Tor exit relay should be
capable of connecting to for clients, as specified by its ExitPolicy.
:param int port: The port corresponding to the above **ipaddress** that
diff --git a/bridgedb/runner.py b/bridgedb/runner.py
index 4591a3a..57297cb 100644
--- a/bridgedb/runner.py
+++ b/bridgedb/runner.py
@@ -128,7 +128,7 @@ def doDumpBridges(config):
This function handles the commandline '--dump-bridges' option.
- :type config: :class:`bridgedb.Main.Conf`
+ :type config: :class:`bridgedb.main.Conf`
:param config: The current configuration.
"""
import bridgedb.Bucket as bucket
diff --git a/bridgedb/test/legacy_Tests.py b/bridgedb/test/legacy_Tests.py
index 77409b4..00e1d12 100644
--- a/bridgedb/test/legacy_Tests.py
+++ b/bridgedb/test/legacy_Tests.py
@@ -18,7 +18,7 @@ import time
from datetime import datetime
import bridgedb.Bridges
-import bridgedb.Main
+import bridgedb.main
import bridgedb.schedule
import bridgedb.Storage
import re
diff --git a/bridgedb/test/test_bridgedb.py b/bridgedb/test/test_bridgedb_script.py
similarity index 100%
rename from bridgedb/test/test_bridgedb.py
rename to bridgedb/test/test_bridgedb_script.py
diff --git a/bridgedb/test/test_Main.py b/bridgedb/test/test_main.py
similarity index 79%
rename from bridgedb/test/test_Main.py
rename to bridgedb/test/test_main.py
index b157fbf..fddb8a9 100644
--- a/bridgedb/test/test_Main.py
+++ b/bridgedb/test/test_main.py
@@ -9,7 +9,7 @@
# (c) 2007-2017, all entities within the AUTHORS file
# :license: see included LICENSE for information
-"""Tests for :mod:`bridgedb.Main`."""
+"""Tests for :mod:`bridgedb.main`."""
from __future__ import print_function
@@ -26,7 +26,7 @@ from time import sleep
from twisted.internet.threads import deferToThread
from twisted.trial import unittest
-from bridgedb import Main
+from bridgedb import main
from bridgedb.parse.options import parseOptions
@@ -50,7 +50,7 @@ p reject 1-65535
def mockUpdateBridgeHistory(bridges, timestamps):
"""A mocked version of :func:`bridgedb.Stability.updateBridgeHistory`
which doesn't access the database (so that we can test functions which
- call it, like :func:`bridgedb.Main.load`).
+ call it, like :func:`bridgedb.main.load`).
"""
for fingerprint, stamps in timestamps.items()[:]:
for timestamp in stamps:
@@ -71,8 +71,8 @@ class MockHashring(object):
pass
-class MainTests(unittest.TestCase):
- """Integration tests for :func:`bridgedb.Main.load`."""
+class BridgedbTests(unittest.TestCase):
+ """Integration tests for :func:`bridgedb.main.load`."""
def _appendToFile(self, file, data):
"""Append **data** to **file**."""
@@ -117,7 +117,7 @@ class MainTests(unittest.TestCase):
def _cbCallUpdateBridgeHistory(self, d, hashring):
"""Fake some timestamps for the bridges in the hashring, and then call
- Main.updateBridgeHistory().
+ main.updateBridgeHistory().
"""
def timestamp():
return datetime.fromtimestamp(random.randint(1324285117, 1524285117))
@@ -128,7 +128,7 @@ class MainTests(unittest.TestCase):
for fingerprint, _ in bridges.items():
timestamps[fingerprint] = [timestamp(), timestamp(), timestamp()]
- return Main.updateBridgeHistory(bridges, timestamps)
+ return main.updateBridgeHistory(bridges, timestamps)
def _eb_Failure(self, failure):
"""If something produces a twisted.python.failure.Failure, fail the
@@ -159,7 +159,7 @@ class MainTests(unittest.TestCase):
"""
# Get the bridgedb.conf file in the top-level directory of this repo:
self.configFile = os.path.join(TOPDIR, 'bridgedb.conf')
- self.config = Main.loadConfig(self.configFile)
+ self.config = main.loadConfig(self.configFile)
# Copy the referenced descriptor files from bridgedb/run/ to CWD:
self.config.STATUS_FILE = self._copyDescFilesHere([self.config.STATUS_FILE])[0]
@@ -167,7 +167,7 @@ class MainTests(unittest.TestCase):
self.config.EXTRA_INFO_FILES = self._copyDescFilesHere(self.config.EXTRA_INFO_FILES)
# Initialise the state
- self.state = Main.persistent.State(**self.config.__dict__)
+ self.state = main.persistent.State(**self.config.__dict__)
self.key = base64.b64decode('TvPS1y36BFguBmSOvhChgtXB2Lt+BOw0mGfz9SZe12Y=')
# Create a pseudo hashring
@@ -175,104 +175,104 @@ class MainTests(unittest.TestCase):
# Functions which some tests mock, which we'll need to re-replace
# later in tearDown():
- self._orig_updateBridgeHistory = Main.updateBridgeHistory
+ self._orig_updateBridgeHistory = main.updateBridgeHistory
self._orig_sys_argv = sys.argv
def tearDown(self):
"""Replace the mocked mockUpdateBridgeHistory() function with the
real function, Stability.updateBridgeHistory().
"""
- Main.updateBridgeHistory = self._orig_updateBridgeHistory
+ main.updateBridgeHistory = self._orig_updateBridgeHistory
sys.argv = self._orig_sys_argv
- def test_Main_updateBridgeHistory(self):
- """Main.updateBridgeHistory should update some timestamps for some
+ def test_main_updateBridgeHistory(self):
+ """main.updateBridgeHistory should update some timestamps for some
bridges.
"""
# Mock the updateBridgeHistory() function so that we don't try to
# access the database:
- Main.updateBridgeHistory = mockUpdateBridgeHistory
+ main.updateBridgeHistory = mockUpdateBridgeHistory
# Get the bridges into the mocked hashring
- d = deferToThread(Main.load, self.state, self.hashring)
+ d = deferToThread(main.load, self.state, self.hashring)
d.addCallback(self._cbAssertFingerprints)
d.addErrback(self._eb_Failure)
d.addCallback(self._cbCallUpdateBridgeHistory, self.hashring)
d.addErrback(self._eb_Failure)
return d
- def test_Main_load(self):
- """Main.load() should run without error."""
- d = deferToThread(Main.load, self.state, self.hashring)
+ def test_main_load(self):
+ """main.load() should run without error."""
+ d = deferToThread(main.load, self.state, self.hashring)
d.addCallback(self._cbAssertFingerprints)
d.addErrback(self._eb_Failure)
return d
- def test_Main_load_no_state(self):
- """Main.load() should raise SystemExit without a state object."""
- self.assertRaises(SystemExit, Main.load, None, self.hashring)
+ def test_main_load_no_state(self):
+ """main.load() should raise SystemExit without a state object."""
+ self.assertRaises(SystemExit, main.load, None, self.hashring)
- def test_Main_load_clear(self):
+ def test_main_load_clear(self):
"""When called with clear=True, load() should run and clear the
hashrings.
"""
- d = deferToThread(Main.load, self.state, self.hashring, clear=True)
+ d = deferToThread(main.load, self.state, self.hashring, clear=True)
d.addCallback(self._cbAssertFingerprints)
d.addErrback(self._eb_Failure)
return d
- def test_Main_load_collect_timestamps(self):
- """When COLLECT_TIMESTAMPS=True, Main.load() should call
- Main.updateBridgeHistory().
+ def test_main_load_collect_timestamps(self):
+ """When COLLECT_TIMESTAMPS=True, main.load() should call
+ main.updateBridgeHistory().
"""
# Mock the addOrUpdateBridgeHistory() function so that we don't try to
# access the database:
- Main.updateBridgeHistory = mockUpdateBridgeHistory
+ main.updateBridgeHistory = mockUpdateBridgeHistory
state = self.state
state.COLLECT_TIMESTAMPS = True
# The reactor is deferring this to a thread, so the test execution
# here isn't actually covering the Storage.updateBridgeHistory()
# function:
- Main.load(state, self.hashring)
+ main.load(state, self.hashring)
- def test_Main_load_malformed_networkstatus(self):
+ def test_main_load_malformed_networkstatus(self):
"""When called with a networkstatus file with an invalid descriptor,
- Main.load() should raise a ValueError.
+ main.load() should raise a ValueError.
"""
self._appendToFile(self.state.STATUS_FILE, NETWORKSTATUS_MALFORMED)
- self.assertRaises(ValueError, Main.load, self.state, self.hashring)
+ self.assertRaises(ValueError, main.load, self.state, self.hashring)
- def test_Main_reloadFn(self):
- """Main._reloadFn() should return True."""
- self.assertTrue(Main._reloadFn())
+ def test_main_reloadFn(self):
+ """main._reloadFn() should return True."""
+ self.assertTrue(main._reloadFn())
- def test_Main_handleSIGHUP(self):
- """Main._handleSIGHUP() should return True."""
+ def test_main_handleSIGHUP(self):
+ """main._handleSIGHUP() should return True."""
raise unittest.SkipTest("_handleSIGHUP touches the reactor.")
- self.assertTrue(Main._handleSIGHUP())
+ self.assertTrue(main._handleSIGHUP())
- def test_Main_createBridgeRings(self):
- """Main.createBridgeRings() should add three hashrings to the
+ def test_main_createBridgeRings(self):
+ """main.createBridgeRings() should add three hashrings to the
hashring.
"""
proxyList = None
- (hashring, emailDist, httpsDist) = Main.createBridgeRings(self.config,
+ (hashring, emailDist, httpsDist) = main.createBridgeRings(self.config,
proxyList,
self.key)
# Should have an HTTPSDistributor ring, an EmailDistributor ring,
# and an UnallocatedHolder ring:
self.assertEqual(len(hashring.ringsByName.keys()), 3)
- def test_Main_createBridgeRings_with_proxyList(self):
- """Main.createBridgeRings() should add three hashrings to the
+ def test_main_createBridgeRings_with_proxyList(self):
+ """main.createBridgeRings() should add three hashrings to the
hashring and add the proxyList to the IPBasedDistibutor.
"""
exitRelays = ['1.1.1.1', '2.2.2.2', '3.3.3.3']
- proxyList = Main.proxy.ProxySet()
+ proxyList = main.proxy.ProxySet()
proxyList.addExitRelays(exitRelays)
- (hashring, emailDist, httpsDist) = Main.createBridgeRings(self.config,
+ (hashring, emailDist, httpsDist) = main.createBridgeRings(self.config,
proxyList,
self.key)
# Should have an HTTPSDistributor ring, an EmailDistributor ring,
@@ -281,14 +281,14 @@ class MainTests(unittest.TestCase):
self.assertGreater(len(httpsDist.proxies), 0)
self.assertItemsEqual(exitRelays, httpsDist.proxies)
- def test_Main_createBridgeRings_no_https_dist(self):
- """When HTTPS_DIST=False, Main.createBridgeRings() should add only
+ def test_main_createBridgeRings_no_https_dist(self):
+ """When HTTPS_DIST=False, main.createBridgeRings() should add only
two hashrings to the hashring.
"""
- proxyList = Main.proxy.ProxySet()
+ proxyList = main.proxy.ProxySet()
config = self.config
config.HTTPS_DIST = False
- (hashring, emailDist, httpsDist) = Main.createBridgeRings(config,
+ (hashring, emailDist, httpsDist) = main.createBridgeRings(config,
proxyList,
self.key)
# Should have an EmailDistributor ring, and an UnallocatedHolder ring:
@@ -296,14 +296,14 @@ class MainTests(unittest.TestCase):
self.assertNotIn('https', hashring.rings)
self.assertNotIn(httpsDist, hashring.ringsByName.values())
- def test_Main_createBridgeRings_no_email_dist(self):
- """When EMAIL_DIST=False, Main.createBridgeRings() should add only
+ def test_main_createBridgeRings_no_email_dist(self):
+ """When EMAIL_DIST=False, main.createBridgeRings() should add only
two hashrings to the hashring.
"""
- proxyList = Main.proxy.ProxySet()
+ proxyList = main.proxy.ProxySet()
config = self.config
config.EMAIL_DIST = False
- (hashring, emailDist, httpsDist) = Main.createBridgeRings(config,
+ (hashring, emailDist, httpsDist) = main.createBridgeRings(config,
proxyList,
self.key)
# Should have an HTTPSDistributor ring, and an UnallocatedHolder ring:
@@ -311,32 +311,32 @@ class MainTests(unittest.TestCase):
self.assertNotIn('email', hashring.rings)
self.assertNotIn(emailDist, hashring.ringsByName.values())
- def test_Main_createBridgeRings_no_reserved_share(self):
- """When RESERVED_SHARE=0, Main.createBridgeRings() should add only
+ def test_main_createBridgeRings_no_reserved_share(self):
+ """When RESERVED_SHARE=0, main.createBridgeRings() should add only
two hashrings to the hashring.
"""
- proxyList = Main.proxy.ProxySet()
+ proxyList = main.proxy.ProxySet()
config = self.config
config.RESERVED_SHARE = 0
- (hashring, emailDist, httpsDist) = Main.createBridgeRings(config,
+ (hashring, emailDist, httpsDist) = main.createBridgeRings(config,
proxyList,
self.key)
# Should have an HTTPSDistributor ring, and an EmailDistributor ring:
self.assertEqual(len(hashring.ringsByName.keys()), 2)
self.assertNotIn('unallocated', hashring.rings)
- def test_Main_createBridgeRings_two_file_buckets(self):
- """When FILE_BUCKETS has two filenames in it, Main.createBridgeRings()
+ def test_main_createBridgeRings_two_file_buckets(self):
+ """When FILE_BUCKETS has two filenames in it, main.createBridgeRings()
should add three hashrings to the hashring, then add two
"pseudo-rings".
"""
- proxyList = Main.proxy.ProxySet()
+ proxyList = main.proxy.ProxySet()
config = self.config
config.FILE_BUCKETS = {
'bridges-for-support-desk': 10,
'bridges-for-ooni-tests': 10,
}
- (hashring, emailDist, httpsDist) = Main.createBridgeRings(config,
+ (hashring, emailDist, httpsDist) = main.createBridgeRings(config,
proxyList,
self.key)
# Should have an HTTPSDistributor ring, an EmailDistributor, and an
@@ -348,8 +348,8 @@ class MainTests(unittest.TestCase):
self.assertIn('pseudo_bridges-for-support-desk', hashring.pseudoRings)
self.assertIn('pseudo_bridges-for-ooni-tests', hashring.pseudoRings)
- def test_Main_run(self):
- """Main.run() should run and then finally raise SystemExit."""
+ def test_main_run(self):
+ """main.run() should run and then finally raise SystemExit."""
config = """
BRIDGE_FILES = ["../run/bridge-descriptors"]
EXTRA_INFO_FILES = ["../run/cached-extrainfo", "../run/cached-extrainfo.new"]
@@ -434,4 +434,4 @@ FILE_BUCKETS = {}"""
sys.argv = ['bridgedb', '-r', os.getcwd(), '-c', configFile]
options = parseOptions()
- self.assertRaises(SystemExit, Main.run, options, reactor=None)
+ self.assertRaises(SystemExit, main.run, options, reactor=None)
diff --git a/doc/sphinx/source/bridgedb.Main.rst b/doc/sphinx/source/bridgedb.main.rst
similarity index 56%
rename from doc/sphinx/source/bridgedb.Main.rst
rename to doc/sphinx/source/bridgedb.main.rst
index 982b567..cf9f9ec 100644
--- a/doc/sphinx/source/bridgedb.Main.rst
+++ b/doc/sphinx/source/bridgedb.main.rst
@@ -1,7 +1,7 @@
-bridgedb.Main
-----------------
+bridgedb.main
+-----------------
-.. automodule:: bridgedb.Main
+.. automodule:: bridgedb.main
:members:
:undoc-members:
:private-members:
diff --git a/doc/sphinx/source/conf.py b/doc/sphinx/source/conf.py
index 906d5fe..8eb0063 100644
--- a/doc/sphinx/source/conf.py
+++ b/doc/sphinx/source/conf.py
@@ -27,6 +27,7 @@ sys.path.insert(0, os.path.abspath(os.path.join(
import bridgedb
+import bridgedb.main
import bridgedb.bridgerequest
import bridgedb.bridges
import bridgedb.captcha
@@ -47,7 +48,6 @@ import bridgedb.distributors.https
import bridgedb.distributors.https.distributor
import bridgedb.distributors.https.request
import bridgedb.distributors.https.server
-import bridgedb.Main
import bridgedb.parse
import bridgedb.parse.addr
import bridgedb.parse.descriptors
diff --git a/scripts/bridgedb b/scripts/bridgedb
index 2ec37b1..876fde9 100644
--- a/scripts/bridgedb
+++ b/scripts/bridgedb
@@ -16,7 +16,7 @@ import sys
from os import getcwd
-from bridgedb.Main import run
+from bridgedb.main import run
from bridgedb.parse.options import parseOptions
1
0
commit 914d0b9a158e3c210d17b84e3648a5962daa97ed
Author: Isis Lovecruft <isis(a)torproject.org>
Date: Wed Nov 1 20:56:23 2017 +0000
Fix output of bridgedb --version.
---
bridgedb/parse/options.py | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/bridgedb/parse/options.py b/bridgedb/parse/options.py
index 6f3bfc1..d866ac8 100644
--- a/bridgedb/parse/options.py
+++ b/bridgedb/parse/options.py
@@ -168,7 +168,13 @@ class BaseOptions(usage.Options):
def opt_version(self):
"""Display BridgeDB's version and exit."""
- print("%s-%s" % (__package__, __version__))
+ if "." in __package__:
+ pkg = __package__.split(".", 1)[0] # Just the parent package
+ else:
+ pkg = __package__
+
+ print("%s-%s" % (pkg, __version__))
+
sys.exit(0)
@staticmethod
1
0
commit 659b4ed3bfea6318ac88880d3fb3bad99b44af89
Merge: 513cd25 b4d32c7
Author: Isis Lovecruft <isis(a)torproject.org>
Date: Tue Sep 12 21:33:22 2017 +0000
Merge branch 'release/0.6.0'
.coveragerc | 2 +
.travis.requirements.txt | 2 +-
CHANGELOG | 12 +
Makefile | 3 +
README.rst | 173 ++++
bridgedb.conf | 104 ++-
bridgedb/Bridges.py | 2 +-
bridgedb/captcha.py | 1 -
bridgedb/configure.py | 16 +-
bridgedb/distributors/__init__.py | 2 +
bridgedb/distributors/common/__init__.py | 2 +
bridgedb/distributors/common/http.py | 80 ++
bridgedb/distributors/email/__init__.py | 24 +
bridgedb/{ => distributors}/email/autoresponder.py | 24 +-
bridgedb/{ => distributors}/email/distributor.py | 13 +-
bridgedb/{ => distributors}/email/dkim.py | 6 +-
bridgedb/{ => distributors}/email/request.py | 12 +-
bridgedb/{ => distributors}/email/server.py | 30 +-
bridgedb/{ => distributors}/email/templates.py | 6 +-
bridgedb/{ => distributors}/https/__init__.py | 4 +
bridgedb/{ => distributors}/https/distributor.py | 19 +-
bridgedb/{ => distributors}/https/request.py | 8 +-
bridgedb/{ => distributors}/https/server.py | 73 +-
.../https/templates/assets/css/bootstrap.min.css | 0
.../https/templates/assets/css/error.css | 0
.../templates/assets/css/font-awesome-ie7.min.css | 0
.../templates/assets/css/font-awesome.min.css | 0
.../https/templates/assets/css/main.css | 0
.../https/templates/assets/css/rtl.css | 0
.../templates/assets/font/fontawesome-webfont.eot | Bin
.../templates/assets/font/fontawesome-webfont.svg | 0
.../templates/assets/font/fontawesome-webfont.ttf | Bin
.../templates/assets/font/fontawesome-webfont.woff | Bin
.../https/templates/assets/font/lato-bold.woff | Bin
.../https/templates/assets/font/lato-italic.woff | Bin
.../https/templates/assets/font/lato-regular.woff | Bin
.../templates/assets/images/404-excavator.svg | 0
.../templates/assets/images/404-hills-left.svg | 0
.../templates/assets/images/404-hills-right.svg | 0
.../assets/images/500-hills-left-shade.svg | 0
.../templates/assets/images/500-hills-left.svg | 0
.../assets/images/500-hills-right-shade.svg | 0
.../templates/assets/images/500-hills-right.svg | 0
.../https/templates/assets/images/500-road.svg | 0
.../assets/images/maintenance-hills-left-shade.svg | 0
.../assets/images/maintenance-hills-left.svg | 0
.../images/maintenance-hills-right-shade.svg | 0
.../assets/images/maintenance-hills-right.svg | 0
.../assets/images/maintenance-tractor.svg | 0
.../https/templates/assets/js/bridges.js | 0
.../https/templates/assets/tor-roots-blue.svg | 0
.../https/templates/assets/tor.svg | 0
.../{ => distributors}/https/templates/base.html | 0
.../https/templates/bridges.html | 0
.../https/templates/captcha.html | 0
.../https/templates/error-404.html | 0
.../https/templates/error-500.html | 0
.../https/templates/error-503.html | 0
.../{ => distributors}/https/templates/howto.html | 0
.../{ => distributors}/https/templates/index.html | 0
.../https/templates/options.html | 0
.../{ => distributors}/https/templates/robots.txt | 0
bridgedb/distributors/moat/__init__.py | 4 +
bridgedb/distributors/moat/distributor.py | 64 ++
bridgedb/distributors/moat/request.py | 133 +++
bridgedb/distributors/moat/server.py | 776 +++++++++++++++++
bridgedb/email/__init__.py | 1 -
bridgedb/{Main.py => main.py} | 95 ++-
bridgedb/parse/addr.py | 4 +-
bridgedb/parse/blacklist.py | 12 +-
bridgedb/parse/options.py | 8 +-
bridgedb/persistent.py | 4 +-
bridgedb/proxy.py | 2 +-
bridgedb/runner.py | 2 +-
bridgedb/strings.py | 4 +-
bridgedb/test/email_helpers.py | 14 +-
bridgedb/test/https_helpers.py | 9 +-
bridgedb/test/legacy_Tests.py | 8 +-
bridgedb/test/moat_helpers.py | 110 +++
.../{test_bridgedb.py => test_bridgedb_script.py} | 0
bridgedb/test/test_distributors_common_http.py | 100 +++
bridgedb/test/test_distributors_moat_request.py | 52 ++
bridgedb/test/test_distributors_moat_server.py | 918 +++++++++++++++++++++
bridgedb/test/test_email_autoresponder.py | 14 +-
bridgedb/test/test_email_distributor.py | 12 +-
bridgedb/test/test_email_dkim.py | 4 +-
bridgedb/test/test_email_request.py | 4 +-
bridgedb/test/test_email_server.py | 20 +-
bridgedb/test/test_email_templates.py | 4 +-
bridgedb/test/test_https_distributor.py | 6 +-
bridgedb/test/test_https_request.py | 4 +-
bridgedb/test/test_https_server.py | 108 +--
bridgedb/test/{test_Main.py => test_main.py} | 255 +++---
bridgedb/test/test_parse_blacklist.py | 56 ++
doc/sphinx/requirements-for-sphinx-builds.txt | 11 +-
doc/sphinx/source/bridgedb.distributors.email.rst | 15 +
doc/sphinx/source/bridgedb.distributors.https.rst | 12 +
doc/sphinx/source/bridgedb.email.rst | 15 -
doc/sphinx/source/bridgedb.https.rst | 12 -
.../{bridgedb.Main.rst => bridgedb.main.rst} | 6 +-
doc/sphinx/source/bridgedb.rst | 6 +-
doc/sphinx/source/conf.py | 27 +-
requirements.txt | 2 +-
scripts/bridgedb | 2 +-
scripts/setup-tests | 7 +
setup.py | 11 +-
106 files changed, 3071 insertions(+), 480 deletions(-)
1
0

15 Nov '17
commit 9ac6ff9e304fbfda71a84996e78c4ada8b43fb9a
Author: Isis Lovecruft <isis(a)torproject.org>
Date: Wed Nov 1 23:55:15 2017 +0000
Exclude test/ directory from coverage results.
---
.coveragerc | 1 +
1 file changed, 1 insertion(+)
diff --git a/.coveragerc b/.coveragerc
index d16f7e2..737310b 100644
--- a/.coveragerc
+++ b/.coveragerc
@@ -10,6 +10,7 @@ omit =
*/_version*
*/__init__*
*/sitecustomize*
+ */test/*
# Regexes for lines to exclude from report generation:
exclude_lines =
pragma: no cover
1
0

15 Nov '17
commit 1112e2e650318c961e5eb8b4af574e9a825682b3
Author: Isis Lovecruft <isis(a)torproject.org>
Date: Wed Nov 1 20:55:10 2017 +0000
Run scheduled tasks after server startup.
---
bridgedb/Main.py | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/bridgedb/Main.py b/bridgedb/Main.py
index 53b70c2..edd93cf 100644
--- a/bridgedb/Main.py
+++ b/bridgedb/Main.py
@@ -488,7 +488,10 @@ def run(options, reactor=reactor):
for name, seconds in config.TASKS.items():
if seconds:
try:
- tasks[name].start(abs(seconds))
+ # Set now to False to get the servers up and running when
+ # first started, rather than spend a bunch of time in
+ # scheduled tasks.
+ tasks[name].start(abs(seconds), now=False)
except KeyError:
logging.info("Task %s is disabled and will not run." % name)
else:
1
0

15 Nov '17
commit 8ebc712bd0706c607fb30222cb304c258bf14d83
Author: Isis Lovecruft <isis(a)torproject.org>
Date: Wed Nov 1 23:55:35 2017 +0000
Add Makefile directive for making TAGS file.
---
Makefile | 3 +++
1 file changed, 3 insertions(+)
diff --git a/Makefile b/Makefile
index 906ce94..428f004 100644
--- a/Makefile
+++ b/Makefile
@@ -86,3 +86,6 @@ upload: clean
python setup.py bdist_egg upload --sign
#python setup.py bdist_wheel upload --sign
python setup.py sdist --formats=gztar,zip upload --sign
+
+tags:
+ find ./bridgedb -type f -name "*.py" -print | xargs etags
1
0