交互式连接建立的实现(rfc 5245)
aioice的Python项目详细描述
什么是aioice?
aioice是用于建立交互连接的库(rfc 5245) 在Python中。它构建在python的标准异步asyncio之上 I/O框架。
交互式连接建立(ICE)对于 建立点对点udp数据流,因为它有助于nat的遍历。 典型的用例包括sip和webrtc。
要了解有关aioice的更多信息,请read the documentation。
示例
#!/usr/bin/env pythonimportasyncioimportaioiceasyncdefconnect_using_ice():connection=aioice.Connection(ice_controlling=True)# gather local candidatesawaitconnection.gather_candidates()# send your information to the remote party using your signaling methodsend_local_info(connection.local_candidates,connection.local_username,connection.local_password)# receive remote information using your signaling methodremote_candidates,remote_username,remote_password=get_remote_info()# perform ICE handshakeconnection.remote_candidates=remote_candidatesconnection.remote_username=remote_usernameconnection.remote_password=remote_passwordawaitconnection.connect()# send and receive dataawaitconnection.sendto(b'1234',1)data,component=awaitconnection.recvfrom()# close connectionawaitconnection.close()asyncio.get_event_loop().run_until_complete(connect_using_ice())
许可证
aioice在BSD license下释放。