def __init__(self,
                 protocolFactoryFactory=None,
                 certificateStorage=None, wrapper=None,
                 q2qPortnum=port,
                 inboundTCPPortnum=None,
                 publicIP=None,
                 udpEnabled=None,
                 portal=None,
                 verifyHook=None):
        """

        @param protocolFactoryFactory: A callable of three arguments
        (fromAddress, toAddress, protocolName) which returns a list of 2-tuples
        of (ProtocolFactory, description) appropriate for constructing
        protocols which can serve the resource specified by the toAddress.

        @param certificateStorage: an implementor of ICertificateStore, or None
        for the default implementation.
        """

        if udpEnabled is not None:
            self.udpEnabled = udpEnabled

        if protocolFactoryFactory is None:
            protocolFactoryFactory = _noResults
        self.protocolFactoryFactory = protocolFactoryFactory
        if certificateStorage is None:
            certificateStorage = DefaultCertificateStore()
            if portal is None:
                portal = Portal(certificateStorage, checkers=[certificateStorage])
        self.certificateStorage = certificateStorage

        # allow protocols to wrap message handlers in transactions.
        self.wrapper = wrapper

        # clients which have registered for network events: maps {(q2q_id,
        # protocol_name): clientQ2QProtocol}
        self.listeningClients = {}

        self.inboundConnections = {} # map of str(Id) to _ConnectionWaiter
        self.q2qPortnum = q2qPortnum # port number for q2q

        # port number for inbound almost-raw TCP
        self.inboundTCPPortnum = inboundTCPPortnum

        # list of independent TCP connections relaying Q2Q traffic.
        self.subConnections = []

        # map of {(fromAddress, protocolName): [(factory, description)]}
        self.localFactoriesMapping = {}

        # currently only used for password-lookup for SIGN, but should be
        # invoked for everything related to connection setup.
        self.portal = portal

        if publicIP is not None:
            self.publicIP = publicIP

        if verifyHook is not None:
            self.verifyHook = verifyHook

        self.appConnectionCache = ConnectionCache()
        self.secureConnectionCache = ConnectionCache()

        service.MultiService.__init__(self)
dataset/ETHPy150Open twisted/vertex/vertex/q2q.py/Q2QService.__init__/original