当前位置: 首页>>代码示例>>Python>>正文


Python interfaces.IReactorSSL方法代码示例

本文整理汇总了Python中twisted.internet.interfaces.IReactorSSL方法的典型用法代码示例。如果您正苦于以下问题:Python interfaces.IReactorSSL方法的具体用法?Python interfaces.IReactorSSL怎么用?Python interfaces.IReactorSSL使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在twisted.internet.interfaces的用法示例。


在下文中一共展示了interfaces.IReactorSSL方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: getHandleErrorCode

# 需要导入模块: from twisted.internet import interfaces [as 别名]
# 或者: from twisted.internet.interfaces import IReactorSSL [as 别名]
def getHandleErrorCode(self):
        """
        Return the argument L{SSL.Error} will be constructed with for this
        case.  This is basically just a random OpenSSL implementation detail.
        It would be better if this test worked in a way which did not require
        this.
        """
        # Windows 2000 SP 4 and Windows XP SP 2 give back WSAENOTSOCK for
        # SSL.Connection.write for some reason.  The twisted.protocols.tls
        # implementation of IReactorSSL doesn't suffer from this imprecation,
        # though, since it is isolated from the Windows I/O layer (I suppose?).

        # If test_properlyCloseFiles waited for the SSL handshake to complete
        # and performed an orderly shutdown, then this would probably be a
        # little less weird: writing to a shutdown SSL connection has a more
        # well-defined failure mode (or at least it should).
        name = fullyQualifiedName(getClass(reactor))
        if platform.getType() == 'win32' and name != self._iocp:
            return errno.WSAENOTSOCK
        # This is terribly implementation-specific.
        return [('SSL routines', 'SSL_write', 'protocol is shutdown')] 
开发者ID:kuri65536,项目名称:python-for-android,代码行数:23,代码来源:test_ssl.py

示例2: listenSSL

# 需要导入模块: from twisted.internet import interfaces [as 别名]
# 或者: from twisted.internet.interfaces import IReactorSSL [as 别名]
def listenSSL(self, port, factory, contextFactory, backlog=50, interface=''):
            """
            @see: twisted.internet.interfaces.IReactorSSL.listenSSL
            """
            port = self.listenTCP(
                port,
                TLSMemoryBIOFactory(contextFactory, False, factory),
                backlog, interface)
            port._type = 'TLS'
            return port 
开发者ID:proxysh,项目名称:Safejumper-for-Desktop,代码行数:12,代码来源:reactor.py

示例3: connectSSL

# 需要导入模块: from twisted.internet import interfaces [as 别名]
# 或者: from twisted.internet.interfaces import IReactorSSL [as 别名]
def connectSSL(self, host, port, factory, contextFactory, timeout=30, bindAddress=None):
            """
            @see: twisted.internet.interfaces.IReactorSSL.connectSSL
            """
            return self.connectTCP(
                host, port,
                TLSMemoryBIOFactory(contextFactory, True, factory),
                timeout, bindAddress) 
开发者ID:proxysh,项目名称:Safejumper-for-Desktop,代码行数:10,代码来源:reactor.py

示例4: createServer

# 需要导入模块: from twisted.internet import interfaces [as 别名]
# 或者: from twisted.internet.interfaces import IReactorSSL [as 别名]
def createServer(self, address, portNumber, factory):
        """
        Create an SSL server with a certificate using L{IReactorSSL.listenSSL}.
        """
        cert = ssl.PrivateCertificate.loadPEM(FilePath(certPath).getContent())
        contextFactory = cert.options()
        return reactor.listenSSL(
            portNumber, factory, contextFactory, interface=address) 
开发者ID:proxysh,项目名称:Safejumper-for-Desktop,代码行数:10,代码来源:test_ssl.py

示例5: getHandleErrorCode

# 需要导入模块: from twisted.internet import interfaces [as 别名]
# 或者: from twisted.internet.interfaces import IReactorSSL [as 别名]
def getHandleErrorCode(self):
        """
        Return the argument L{OpenSSL.SSL.Error} will be constructed with for
        this case. This is basically just a random OpenSSL implementation
        detail. It would be better if this test worked in a way which did not
        require this.
        """
        # Windows 2000 SP 4 and Windows XP SP 2 give back WSAENOTSOCK for
        # SSL.Connection.write for some reason.  The twisted.protocols.tls
        # implementation of IReactorSSL doesn't suffer from this imprecation,
        # though, since it is isolated from the Windows I/O layer (I suppose?).

        # If test_properlyCloseFiles waited for the SSL handshake to complete
        # and performed an orderly shutdown, then this would probably be a
        # little less weird: writing to a shutdown SSL connection has a more
        # well-defined failure mode (or at least it should).

        # So figure out if twisted.protocols.tls is in use.  If it can be
        # imported, it should be.
        if requireModule('twisted.protocols.tls') is None:
            # It isn't available, so we expect WSAENOTSOCK if we're on Windows.
            if platform.getType() == 'win32':
                return errno.WSAENOTSOCK

        # Otherwise, we expect an error about how we tried to write to a
        # shutdown connection.  This is terribly implementation-specific.
        return [('SSL routines', 'SSL_write', 'protocol is shutdown')] 
开发者ID:proxysh,项目名称:Safejumper-for-Desktop,代码行数:29,代码来源:test_ssl.py

示例6: listenSSL

# 需要导入模块: from twisted.internet import interfaces [as 别名]
# 或者: from twisted.internet.interfaces import IReactorSSL [as 别名]
def listenSSL(self, port, factory, contextFactory, backlog=50, interface=''):
            """
            @see: twisted.internet.interfaces.IReactorSSL.listenSSL
            """
            return self.listenTCP(
                port,
                TLSMemoryBIOFactory(contextFactory, False, factory),
                backlog, interface) 
开发者ID:kuri65536,项目名称:python-for-android,代码行数:10,代码来源:reactor.py

示例7: connectTCP

# 需要导入模块: from twisted.internet import interfaces [as 别名]
# 或者: from twisted.internet.interfaces import IReactorSSL [as 别名]
def connectTCP(self, host, port, factory, timeout=30, bindAddress=None):
        """@see: twisted.internet.interfaces.IReactorTCP.connectTCP
        """
        c = tcp.Connector(host, port, factory, timeout, bindAddress, self)
        c.connect()
        return c

    # IReactorSSL (sometimes, not implemented) 
开发者ID:kuri65536,项目名称:python-for-android,代码行数:10,代码来源:posixbase.py

示例8: listenSSL

# 需要导入模块: from twisted.internet import interfaces [as 别名]
# 或者: from twisted.internet.interfaces import IReactorSSL [as 别名]
def listenSSL(self, port, factory, contextFactory, backlog=50, interface=''):
        """@see: twisted.internet.interfaces.IReactorSSL.listenSSL
        """
        assert sslEnabled, "SSL support is not present"
        p = ssl.Port(port, factory, contextFactory, backlog, interface, self)
        p.startListening()
        return p


    # IReactorArbitrary 
开发者ID:kuri65536,项目名称:python-for-android,代码行数:12,代码来源:posixbase.py

示例9: createServer

# 需要导入模块: from twisted.internet import interfaces [as 别名]
# 或者: from twisted.internet.interfaces import IReactorSSL [as 别名]
def createServer(self, address, portNumber, factory):
        """
        Create an SSL server with a certificate using L{IReactorSSL.listenSSL}.
        """
        cert = ssl.PrivateCertificate.loadPEM(file(certPath).read())
        contextFactory = cert.options()
        return reactor.listenSSL(
            portNumber, factory, contextFactory, interface=address) 
开发者ID:kuri65536,项目名称:python-for-android,代码行数:10,代码来源:test_ssl.py

示例10: connectClient

# 需要导入模块: from twisted.internet import interfaces [as 别名]
# 或者: from twisted.internet.interfaces import IReactorSSL [as 别名]
def connectClient(self, address, portNumber, clientCreator):
        """
        Create an SSL client using L{IReactorSSL.connectSSL}.
        """
        contextFactory = ssl.CertificateOptions()
        return clientCreator.connectSSL(address, portNumber, contextFactory) 
开发者ID:kuri65536,项目名称:python-for-android,代码行数:8,代码来源:test_ssl.py

示例11: connectSSL

# 需要导入模块: from twisted.internet import interfaces [as 别名]
# 或者: from twisted.internet.interfaces import IReactorSSL [as 别名]
def connectSSL(self, host, port, factory, contextFactory, timeout=30, bindAddress=None):
        """@see: twisted.internet.interfaces.IReactorSSL.connectSSL
        """
        assert sslEnabled, "SSL support is not present"
        c = ssl.Connector(host, port, factory, contextFactory, timeout, bindAddress, self)
        c.connect()
        return c 
开发者ID:kenorb-contrib,项目名称:BitTorrent,代码行数:9,代码来源:posixbase.py

示例12: listenSSL

# 需要导入模块: from twisted.internet import interfaces [as 别名]
# 或者: from twisted.internet.interfaces import IReactorSSL [as 别名]
def listenSSL(self, port, factory, contextFactory, backlog=50, interface=''):
        """@see: twisted.internet.interfaces.IReactorSSL.listenSSL
        """
        assert sslEnabled, "SSL support is not present"
        p = ssl.Port(port, factory, contextFactory, backlog, interface, self)
        p.startListening()
        return p

    # IReactorArbitrary 
开发者ID:kenorb-contrib,项目名称:BitTorrent,代码行数:11,代码来源:posixbase.py


注:本文中的twisted.internet.interfaces.IReactorSSL方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。