Пример #1
0
class MailpileKeyInfo(KeyInfo):
    KEYS = dict_merge(KeyInfo.KEYS, {
        'vcards':       (dict, None),
        'origins':      (list, None),
        'scores':       (dict, None),
        'score_stars':  (int, 0),
        'score_reason': (unicode, None),
        'score':        (int, 0)})
Пример #2
0
class MailpileKeyInfo(KeyInfo):
    KEYS = dict_merge(KeyInfo.KEYS, {
        'vcards':       (dict, None),
        'origins':      (list, None),
        'is_autocrypt': (bool, False),
        'is_gossip':    (bool, False),
        'is_preferred': (bool, False),
        'is_pinned':    (bool, False),
        'scores':       (dict, None),
        'score_stars':  (int, 0),
        'score_reason': (str, None),
        'score':        (int, 0)})
Пример #3
0
class TorConnBroker(SocksConnBroker):
    """
    This broker offers the same services as the TcpConnBroker, but over Tor.

    This removes the "trackable" capability, so requests that reject it can
    find their way here safely...

    This broker only volunteers to carry encrypted traffic, because Tor
    exit nodes may be hostile.
    """
    SUPPORTS = []
    CONFIGURED = (Capability.ALL_OUTGOING_ENCRYPTED -
                  set([Capability.OUTGOING_TRACKABLE]))
    REJECTS = None
    PROXY_TYPES = ('tor', )
    DEFAULT_PROTO = 'tor'

    DEBUG_FMT = '%s: Raw Tor conn to: %s'
    IOERROR_FMT = _('Tor error, %s')
    IOERROR_MSG = dict_merge(
        SocksConnBroker.IOERROR_MSG,
        {
            'bad input': _('connection refused')  # FIXME: Is this right?
        })

    def _describe(self, context, conn):
        context.on_darknet = 'Tor'
        context.anonymity = 'Tor'
        return conn

    def _auth_args(self):
        # FIXME: Tor uses the auth information as a signal to change
        #        circuits. We may have use for this at some point.
        return {}

    def _fix_address_tuple(self, address):
        host = str(address[0])
        return (KNOWN_ONION_MAP.get(host.lower(), host), int(address[1]))

    def _broker_avoid(self, address):
        # Disable the avoiding of .onion addresses added above
        pass