quic的实现
aioquic的Python项目详细描述
什么是aioquic?
aioquic是python中quic网络协议的库。它的特点 最小的tls 1.3实现、quic堆栈和http/3堆栈。
QUIC标准化尚未最终确定,但aioquic密切跟踪 规范草案,并定期测试与其他规范的互操作性 QUIC implementations。
要了解有关aioquic的更多信息,请read the documentation。
为什么要使用aioquic?
aioquic被设计为嵌入到python客户机和服务器中 希望支持quic和/或http/3的库。目标是提供 python库的公共代码库,希望避免重复工作。
quic和http/3api都遵循“自带i/o”模式, 将实际的I/O操作留给API用户。这种方法有很多 优点包括使代码可测试并允许与 不同的并发模型。
功能
- 符合草案-22的QUIC堆栈
- 符合draft-22的http/3堆栈
- 最小TLS 1.3实现
- IPv4和IPv6支持
- 连接迁移和NAT重新绑定
- 记录TLS交通机密
- 以qlog格式记录quic事件
运行示例
aioquic需要python 3.6或更高版本以及openssl开发头文件。
$ sudo apt install libssl-dev python3-dev
使用git签出代码后,您可以运行:
$ pip install -e . $ pip install aiofiles asgiref httpbin starlette wsproto
http/3服务器
您可以运行示例服务器,它同时处理http/0.9和http/3:
$ python examples/http3_server.py --certificate tests/ssl_cert.pem --private-key tests/ssl_key.pem
http/3客户端
您可以运行示例客户机来执行http/3请求:
$ python examples/http3_client.py https://localhost:4433/
或者,您可以执行http/0.9请求:
$ python examples/http3_client.py --legacy-http https://localhost:4433/
您还可以通过http/3打开websocket:
$ python examples/http3_client.py wss://localhost:4433/ws
许可证
aioquic在BSD license下释放。