初始版本:基于 DHT 的去中心化聊天客户端

- 纯标准库实现 Kademlia DHT(UDP + asyncio),报文 Ed25519 签名认证
- 超过 1200 字节的载荷自动分片与重组,上限 1 MiB
- 公共聊天室:成员公告 + DHT 日志回放,迟到入群者也能补到历史
- 一对一私聊:X25519 + HKDF + AEAD 端到端加密,支持离线信箱
- Tkinter 图形界面,asyncio 运行在后台线程,事件经队列回传 UI
- 局域网组播自动发现 + 手动引导地址(-b)两种互联方式
- run.cmd / start.bat 启动脚本,自动寻找 py -3 或 python
- 48 个单元测试覆盖密码学原语、DHT 路由/协议与聊天层

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
MrhongxingandCopilot committed 2026-09-18 17:38:36 +08:00
commit e002ba9f62
19 files changed
+5064

No files matched your search

+23
View File
@@ -0,0 +1,23 @@
"""dhtchat -- a serverless chat client built on a Kademlia DHT.
The package is pure Python standard library: no third party dependency has to
be installed before ``python -m dhtchat`` works on Windows, Linux or macOS.
Layers
------
``crypto`` Ed25519/X25519/AEAD primitives (RFC 8032 / 7748 compliant)
``routing`` Kademlia routing table
``store`` replicated key/value store with merge semantics
``protocol`` UDP wire format, including transparent fragmentation
``node`` the DHT node itself (RPC, iterative lookups, relaying)
``chat`` rooms, private messages and DHT backed history
``app`` thread safe facade used by the GUI
``gui`` Tkinter desktop client
"""
from .chat import ChatService
from .identity import Identity
from .node import DhtNode
__version__ = "1.0.0"
__all__ = ["ChatService", "DhtNode", "Identity", "__version__"]