Files
AI-Create-Dht-Chat/run.cmd
T
MrhongxingandCopilot e002ba9f62 初始版本:基于 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>
2026-09-18 17:38:36 +08:00

35 lines
1.2 KiB
Batchfile
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
@echo off
rem ---------------------------------------------------------------------------
rem DHT 聊天客户端启动脚本(所有参数都会透传给 python -m dhtchat)
rem 用法示例:
rem run.cmd 启动图形界面
rem run.cmd --nick 小明 指定昵称
rem run.cmd -b 192.168.1.7:47800 手动指定引导节点
rem run.cmd --no-gui 使用命令行界面
rem ---------------------------------------------------------------------------
setlocal
cd /d "%~dp0"
set "DHTCHAT_PY="
where py >nul 2>nul && py -3 -c "import sys" >nul 2>nul && set "DHTCHAT_PY=py -3"
if not defined DHTCHAT_PY (
where python >nul 2>nul && python -c "import sys" >nul 2>nul && set "DHTCHAT_PY=python"
)
if not defined DHTCHAT_PY (
echo [错误] 没有找到可用的 Python 3。
echo 请到 https://www.python.org/downloads/windows/ 安装,
echo 安装时勾选 "Add python.exe to PATH"。
exit /b 9009
)
%DHTCHAT_PY% -c "import tkinter" >nul 2>nul
if errorlevel 1 (
echo [提示] 当前 Python 缺少 tkinter,将改用命令行界面。
%DHTCHAT_PY% -m dhtchat --no-gui %*
exit /b %errorlevel%
)
%DHTCHAT_PY% -m dhtchat %*
exit /b %errorlevel%