 kevinandClaude
|
d57dff58f3
|
重构:把剩余 12 个顶层包全部迁到 internal/
继续之前的重构:把根目录残留的非数据/资源类子目录(agents、agenttool、ai、
autoreply、completion、conversation、llm、message、mqtpp、stream、
toolmanager、toolrouter)一并搬到 internal/ 下,并把全工程引用它们的
import 路径从 "meshtastic_mqtt_server/<x>" 重写为
"meshtastic_mqtt_server/internal/<x>"。
变更
- git mv 12 个顶层目录进 internal/,无函数体改动。
- 全工程 sed 把 import path 加上 internal/ 前缀,包括 main.go、
internal/bot/bot_service.go、internal/store/bot_store.go 中对 mqtpp
的引用,以及 ai 子系统内部 agents/agenttool/autoreply/conversation/
llm/toolmanager/toolrouter 之间的相互引用。
验证
- go build ./... 通过;go test ./... 全部包通过。
- AI 自动回复链路(main → ai.NewService → autoreply.Service → botSender)
保持不变,仅 import 路径调整。
- 根目录最终只剩 main.go / main_test.go / internal/ 加 go.mod / go.sum
与数据资源目录(dist、doc、firmware、py、win、meshmap_frontend)。
Co-Authored-By: Claude <noreply@anthropic.com>
|
2026-06-18 18:43:42 +08:00 |
|
 kevinandClaude
|
46916d9a93
|
重构:main.go 直接 import 各 internal/ 子包,删除全部 bridge
最后一步:把 main.go 里所有指向桥接小写名的引用(store / config /
blocking / bot / runtimesettings / mqttforward / web 等)改写成直接调用
internal/* 子包的导出 API,从而拆掉所有 *_bridge.go。
变更点
- main.go 顶部 import 区改为引用 11 个 internal/ 子包:auth、blocking、
bot、config、mqttforward、runtimesettings、store、web 等。
- meshtasticFilterHook 字段类型改为 *storepkg.WriteQueue / *blockingpkg.Cache
/ *rspkg.Cache / *mqttforwardpkg.Stats;不再依赖 main 包内别名。
- mqttClientInfoFromClient 返回 storepkg.MQTTClientInfo(之前为 main 包别名)。
- run() 里 newSessionManager → auth.NewManager;newRouter → webpkg.NewRouter;
serveHTTPUnixSocket → webpkg.ServeUnixSocket;mqttRuntimeStatus →
webpkg.MQTTRuntimeStatus;botSendTextRequest → botpkg.SendTextRequest;
newBlockingCache / newRuntimeSettingsCache / newMQTTForwardManager 都改为
对应包的 New / NewManager。
- main_test.go 里的 BlockingViolationForRecord 测试改用 testutil.OpenStore
+ blockingpkg.New,全部通过 store.Store 的公开 API 构造数据,不再需要
根目录 test_helpers_test.go。
删除根目录文件
- config.go、auth.go(已删)、blocking_bridge.go、bot_bridge.go、
help_bridge.go、llmadmin_bridge.go、mapsource_bridge.go、
mqttforward_bridge.go、runtime_settings_bridge.go、sign_bridge.go、
store_bridge.go、web_bridge.go、test_helpers_test.go。
最终结果
- 根目录只剩 main.go (~370 行) 和 main_test.go (~110 行)。
- internal/ 下 13 个独立子包:auth / blocking / bot / config / help /
llmadmin / mapsource / mqttforward / runtimesettings / sign / store /
store/testutil / web / webutil。
- go build ./... / go test ./... 全部通过;测试数量与重构前一致;
go build . 可以产出可执行二进制(约 50 MB)。
Co-Authored-By: Claude <noreply@anthropic.com>
|
2026-06-18 18:30:00 +08:00 |
|
 kevinandClaude
|
eff4972668
|
重构:拆出 internal/config 与 internal/store 子包
把工程根目录中和"配置加载"、"数据存储"两个领域相关的全部 Go 文件迁到
internal/ 下的子包,按功能分组的第一阶段成果。
internal/config/
- 从 config.go 抽出 Config / MQTTConfig / WebConfig / DatabaseConfig 等
类型并大写导出,函数改名 Default/Load/Write/Validate/BuildTLS 等。
- 测试随被测代码迁移成 package config 的内部测试。
- 根目录留 config.go 作桥接:用 type alias 让旧的小写名(config /
mqttConfig / databaseConfig 等)继续可用,避免修改 30+ 处调用方。
internal/store/
- 把 db.go、store_query.go、db_write_queue.go 与 13 个 *_store.go 一并
迁入;26 个 *Record 类型与 store 同包以避免循环依赖。
- store -> Store;50+ 标识符从小写未导出改为大写导出(包括 record、
ListOptions、错误变量、bot/llm/runtime 常量、helpers 等)。
- 新增 DB() / Driver() 访问器供 ai 子系统使用,避免直接访问私有字段。
- bot_pki_store.go 独立出来,把 PKI 解密所需的 store 方法集中归类。
- helpers.go 提供 hashPassword / uint32FromRecord / printJSON 等以前在
其他根目录文件中的辅助;test_helpers_test.go 提供 verifyPassword
与 publicMapTileSourceDTO 让测试可以本地运行而不依赖 main 包。
根目录新增:
- store_bridge.go:完整 type-alias / 函数包装层,把 internal/store 的
导出名映射回旧的小写名,让 admin_*_routes.go、web.go、bot_service.go
等仍未迁出的文件继续编译。后续步骤把它们迁到各自领域包后可逐步删除。
- test_helpers_test.go:根目录测试沿用 openTestStore 的入口。
go build ./... 与 go test ./... 全部通过;测试数量与重构前一致。
Co-Authored-By: Claude <noreply@anthropic.com>
|
2026-06-18 13:56:36 +08:00 |
|
kevin
|
fcd230cb5b
|
写成屎山了
|
2026-06-18 08:35:09 +08:00 |
|
kevin
|
45822fd333
|
工具路由还没实现
|
2026-06-18 08:14:09 +08:00 |
|
kevin
|
ce07792c4b
|
up
|
2026-06-17 23:54:38 +08:00 |
|
 kevinandClaude
|
0f04047517
|
支持 Web 端口和 Sock 同时启用
Co-Authored-By: Claude <noreply@anthropic.com>
|
2026-06-16 19:36:47 +08:00 |
|
kevin
|
67330d4656
|
优化机器人ack
|
2026-06-14 19:56:20 +08:00 |
|
kevin
|
757eb852fd
|
更新机器人接收功能
|
2026-06-14 19:41:52 +08:00 |
|
kevin
|
609462252c
|
机器人功能还差发送nodeinfo
|
2026-06-12 19:24:40 +08:00 |
|
kevin
|
2e96faf5a2
|
Merge branch 'main' of https://git.lmve.net/kevin/meshtastic_mqtt_server
# Conflicts:
# meshmap_frontend/src/App.vue
# web.go
|
2026-06-12 18:15:30 +08:00 |
|
kevin
|
b645907c52
|
新增机器人功能
|
2026-06-12 18:07:53 +08:00 |
|
kevin
|
563d609121
|
服务器代理地图数据
|
2026-06-06 12:01:46 +08:00 |
|
kevin
|
fb1971da72
|
增加转发开关
|
2026-06-05 20:03:52 +08:00 |
|
kevin
|
d962ccf9af
|
新增mqtt转发功能
|
2026-06-05 18:49:30 +08:00 |
|
kevin
|
081600eff0
|
异步保存sql消息
|
2026-06-05 13:34:54 +08:00 |
|
kevin
|
6fb6fc4f10
|
修复跨端问题
|
2026-06-04 17:49:31 +08:00 |
|
kevin
|
25decaba71
|
部署脚本
|
2026-06-04 16:29:52 +08:00 |
|
kevin
|
2e6eab3e01
|
屏蔽词功能ok
|
2026-06-04 15:20:40 +08:00 |
|
kevin
|
f73d79b7d4
|
基本功能差不多完成
|
2026-06-04 09:52:57 +08:00 |
|
kevin
|
7c1b30b3a0
|
统计相关更新
|
2026-06-04 00:09:16 +08:00 |
|
kevin
|
9221a53617
|
新增后台管理
|
2026-06-03 23:29:21 +08:00 |
|
kevin
|
3ae2ffa098
|
分表
|
2026-06-03 22:34:25 +08:00 |
|
kevin
|
26126771f4
|
up
|
2026-06-03 20:26:15 +08:00 |
|
kevin
|
9748a1e681
|
添加前端
|
2026-06-03 18:31:15 +08:00 |
|
kevin
|
6ccced6cd3
|
新增几个数据表
|
2026-06-03 17:14:49 +08:00 |
|
kevin
|
8c1e1ef414
|
text_message 表设计与实现
|
2026-06-03 15:08:32 +08:00 |
|
kevin
|
d887845909
|
增加数据库支持
|
2026-06-03 14:09:48 +08:00 |
|
kevin
|
44dfb14cf4
|
增加配置文件
|
2026-06-03 13:41:54 +08:00 |
|
kevin
|
618bde456a
|
将mqtt客户端改成mqtt服务端
|
2026-06-03 11:52:55 +08:00 |
|
kevin
|
2df622f8e1
|
up
|
2026-06-03 01:55:11 +08:00 |
|
kevin
|
c279181123
|
分离功能
|
2026-06-03 01:41:10 +08:00 |
|
kevin
|
5ab183af90
|
解码功能完成
|
2026-06-03 00:26:25 +08:00 |
|
kevin
|
0a9f54f2c3
|
go重构
|
2026-06-03 00:04:05 +08:00 |
|