Go to the latest version of this document.
search in docstrings

Search bar offers the following options:

- Term presence. The below example searches for documents that must contain “foo”, might contain “bar” and must not contain “baz”: `+foo bar -baz`
- Wildcards. The below example searches for documents with words beginning with “foo”: `foo*`
- Search in specific fields. The following search matches all objects in "twisted.mail" that matches “search”: `+qname:twisted.mail.* +search`

  Possible fields: 'name', 'qname' (fully qualified name), 'docstring', and 'kind'. Last two fields are only applicable if "search in docstrings" is enabled.

- Fuzzy matches. The following search matches all documents that have a word within 1 edit distance of “foo”: `foo~1`

Results provided by Lunr.js

# ``twisted`.`protocols`.`tls`.`TLSMemoryBIOFactory``

class documentation

`class TLSMemoryBIOFactory(WrappingFactory): (source)`

View In Hierarchy

`TLSMemoryBIOFactory` adds TLS to connections.

Method | `__init__` | Create a `TLSMemoryBIOFactory`.
Method | `logPrefix` | Annotate the wrapped factory's log prefix with some text indicating TLS is in use.
Class Variable | `noisy` | Undocumented
Method | `_applyProtocolNegotiation` | Applies ALPN/NPN protocol neogitation to the connection, if the factory supports it.
Method | `_createConnection` | Create an OpenSSL connection and set it up good.
Instance Variable | `_connectionCreator` | a callable which creates an OpenSSL Connection object.
Instance Variable | `_creatorInterface` | the interface which `_connectionCreator` is expected to implement.

Inherited from `WrappingFactory`:

Method | `buildProtocol` | Create an instance of a subclass of Protocol.
Method | `clientConnectionFailed` | Called when a connection has failed to connect.
Method | `clientConnectionLost` | Called when an established connection is lost.
Method | `doStart` | Make sure startFactory is called.
Method | `doStop` | Make sure stopFactory is called.
Method | `registerProtocol` | Called by protocol to register itself.
Method | `startedConnecting` | Called when a connection has been started.
Method | `unregisterProtocol` | Called by protocols when they go away.
Instance Variable | `protocols` | Undocumented
Instance Variable | `wrappedFactory` | Undocumented

Inherited from `Factory` (via `WrappingFactory`, `ClientFactory`):

Class Method | `forProtocol` | Create a factory for the given protocol.
Method | `startFactory` | This will be called before I begin listening on a Port or Connector.
Method | `stopFactory` | This will be called before I stop listening on all Ports/Connectors.
Class Variable | `protocol` | Undocumented
Instance Variable | `numPorts` | Undocumented

def __init__(self, contextFactory, isClient, wrappedFactory): (source)
overrides `twisted.protocols.policies.WrappingFactory.__init__`

Create a `TLSMemoryBIOFactory`.

Parameters

contextFactory:`IOpenSSLClientConnectionCreator` or `IOpenSSLServerConnectionCreator`, or, for compatibility with older code, anything implementing `twisted.internet.interfaces.IOpenSSLContextFactory`. See https://twistedmatrix.com/trac/ticket/7215 for information on the upcoming deprecation of passing a `twisted.internet.ssl.ContextFactory` here.

Configuration parameters used to create an OpenSSL connection. In order of preference, what you should pass here should be:

1. `twisted.internet.ssl.CertificateOptions` (if you're writing a server) or the result of `twisted.internet.ssl.optionsForClientTLS` (if you're writing a client). If you want security you should really use one of these.
2. If you really want to implement something yourself, supply a provider of `IOpenSSLClientConnectionCreator` or `IOpenSSLServerConnectionCreator`.
3. If you really have to, supply a `twisted.internet.ssl.ContextFactory`. This will likely be deprecated at some point so please upgrade to the new interfaces.

isClient:`bool` | Is this a factory for TLS client connections; in other words, those that will send a `ClientHello` greeting? `True` if so, `False` otherwise. This flag determines what interface is expected of `contextFactory`. If `True`, `contextFactory` should provide `IOpenSSLClientConnectionCreator`; otherwise it should provide `IOpenSSLServerConnectionCreator`.
wrappedFactory:`twisted.internet.interfaces.IProtocolFactory` | A factory which will create the application-level protocol.

def logPrefix(self): (source)
from `twisted.internet.interfaces.ILoggingContext`
overrides `twisted.protocols.policies.WrappingFactory.logPrefix`

Annotate the wrapped factory's log prefix with some text indicating TLS is in use.

Returns
`str` | Undocumented

noisy: `bool` = (source)
overrides `twisted.internet.protocol.Factory.noisy`

Undocumented

def _applyProtocolNegotiation(self, connection): (source)

Applies ALPN/NPN protocol neogitation to the connection, if the factory supports it.

Parameters
connection:`OpenSSL.SSL.Connection` | The OpenSSL connection object to have ALPN/NPN added to it.
Returns
`None` | Nothing

def _createConnection(self, tlsProtocol): (source)

Create an OpenSSL connection and set it up good.

Parameters
tlsProtocol:`TLSMemoryBIOProtocol` | The protocol which is establishing the connection.
Returns
`OpenSSL.SSL.Connection` | an OpenSSL connection object for `tlsProtocol` to use

_connectionCreator: 1-argument callable taking `TLSMemoryBIOProtocol` and returning `OpenSSL.SSL.Connection`. = (source)

a callable which creates an OpenSSL Connection object.

_creatorInterface: `zope.interface.interfaces.IInterface` = (source)

the interface which `_connectionCreator` is expected to implement.