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


Python Protocol.keyfile方法代码示例

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


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

示例1: make_protocol

# 需要导入模块: from xpra.net.protocol import Protocol [as 别名]
# 或者: from xpra.net.protocol.Protocol import keyfile [as 别名]
 def make_protocol(self, socktype, conn, frominfo=""):
     netlog.info("New %s connection received%s", socktype, frominfo)
     protocol = Protocol(self, conn, self.process_packet)
     self._potential_protocols.append(protocol)
     protocol.large_packets.append("info-response")
     protocol.challenge_sent = False
     protocol.authenticator = None
     if socktype=="tcp":
         protocol.auth_class = self.tcp_auth_class
         protocol.encryption = self.tcp_encryption
         protocol.keyfile = self.tcp_encryption_keyfile
     elif socktype=="vsock":
         protocol.auth_class = self.vsock_auth_class
         protocol.encryption = None
         protocol.keyfile = None
     else:
         protocol.auth_class = self.auth_class
         protocol.encryption = self.encryption
         protocol.keyfile = self.encryption_keyfile
     protocol.socket_type = socktype
     protocol.invalid_header = self.invalid_header
     protocol.receive_aliases.update(self._aliases)
     authlog("socktype=%s, auth class=%s, encryption=%s, keyfile=%s", socktype, protocol.auth_class, protocol.encryption, protocol.keyfile)
     if protocol.encryption and ENCRYPT_FIRST_PACKET:
         password = self.get_encryption_key(None, protocol.keyfile)
         protocol.set_cipher_in(protocol.encryption, DEFAULT_IV, password, DEFAULT_SALT, DEFAULT_ITERATIONS, INITIAL_PADDING)
     protocol.start()
     self.timeout_add(SOCKET_TIMEOUT*1000, self.verify_connection_accepted, protocol)
     return True
开发者ID:ljmljz,项目名称:xpra,代码行数:31,代码来源:server_core.py

示例2: _new_connection

# 需要导入模块: from xpra.net.protocol import Protocol [as 别名]
# 或者: from xpra.net.protocol.Protocol import keyfile [as 别名]
 def _new_connection(self, listener, *args):
     if self._closing:
         netlog.warn("ignoring new connection during shutdown")
         return False
     socktype = self.socket_types.get(listener)
     assert socktype, "cannot find socket type for %s" % listener
     sock, address = listener.accept()
     if len(self._potential_protocols)>=self._max_connections:
         netlog.error("too many connections (%s), ignoring new one", len(self._potential_protocols))
         sock.close()
         return True
     try:
         peername = sock.getpeername()
     except:
         peername = str(address)
     sockname = sock.getsockname()
     target = peername or sockname
     sock.settimeout(self._socket_timeout)
     netlog("new_connection(%s) sock=%s, timeout=%s, sockname=%s, address=%s, peername=%s", args, sock, self._socket_timeout, sockname, address, peername)
     sc = SocketConnection(sock, sockname, address, target, socktype)
     netlog("socket connection: %s", sc)
     frominfo = ""
     if peername:
         frominfo = " from %s" % pretty_socket(peername)
     elif socktype=="unix-domain":
         frominfo = " on %s" % sockname
     netlog.info("New %s connection received%s", socktype, frominfo)
     protocol = Protocol(self, sc, self.process_packet)
     self._potential_protocols.append(protocol)
     protocol.large_packets.append("info-response")
     protocol.challenge_sent = False
     protocol.authenticator = None
     if socktype=="tcp":
         protocol.auth_class = self.tcp_auth_class
         protocol.encryption = self.tcp_encryption
         protocol.keyfile = self.tcp_encryption_keyfile
     else:
         protocol.auth_class = self.auth_class
         protocol.encryption = self.encryption
         protocol.keyfile = self.encryption_keyfile
     protocol.socket_type = socktype
     protocol.invalid_header = self.invalid_header
     protocol.receive_aliases.update(self._aliases)
     authlog("socktype=%s, auth class=%s, encryption=%s, keyfile=%s", socktype, protocol.auth_class, protocol.encryption, protocol.keyfile)
     if protocol.encryption and ENCRYPT_FIRST_PACKET:
         password = self.get_encryption_key(None, protocol.keyfile)
         protocol.set_cipher_in(protocol.encryption, DEFAULT_IV, password, DEFAULT_SALT, DEFAULT_ITERATIONS, INITIAL_PADDING)
     protocol.start()
     self.timeout_add(SOCKET_TIMEOUT*1000, self.verify_connection_accepted, protocol)
     return True
开发者ID:svn2github,项目名称:Xpra,代码行数:52,代码来源:server_core.py


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