def _create_ssl_context(self) -> Optional[SSLContext]:
        """
        创建 ssl
        """
        ssl_context = None
        if self.cfg.is_ssl:
            ssl_context = SSLContext(self.cfg.ssl_version)
            ssl_context.load_cert_chain(self.cfg.certfile, self.cfg.keyfile)
            if self.cfg.ca_certs:
                ssl_context.load_verify_locations(self.cfg.ca_certs)
            if self.cfg.ciphers:
                ssl_context.set_ciphers(self.cfg.ciphers)
            ssl_context.set_alpn_protocols(['http/1.1'])
        return ssl_context
def _create_ssl_context ( self ) -> Optional [ SSLContext ] : ssl_context = None if self . cfg . is_ssl : ssl_context = SSLContext ( self . cfg . ssl_version ) ssl_context . load_cert_chain ( self . cfg . certfile , self . cfg . keyfile ) if self . cfg . ca_certs : ssl_context . load_verify_locations ( self . cfg . ca_certs ) if self . cfg . ciphers : ssl_context . set_ciphers ( self . cfg . ciphers ) ssl_context . set_alpn_protocols ( [ 'http/1.1' ] ) return ssl_context
创建 ssl