0bedd1c4d1
ci-pangolin / Lint — shellcheck (push) Has been cancelled
ci-pangolin / OpenAPI Sync Check (push) Has been cancelled
ci-pangolin / Redline Scan — 脱敏 (UI 文案) (push) Has been cancelled
ci-pangolin / Flutter — analyze + test (push) Has been cancelled
ci-pangolin / Portable SQL — 可移植性 (mysql/sqlite) (push) Has been cancelled
ci-pangolin / Codegen Drift — token 生成物未漂移 (push) Has been cancelled
ci-pangolin / Go — build + test (push) Has been cancelled
ci-pangolin / E2E Smoke — L4 进程级端到端 (push) Has been cancelled
ci-pangolin / Go — integration (mysql/redis testcontainers) (push) Has been cancelled
ci-pangolin / Golden — 视觉回归 (components + auth) (push) Has been cancelled
漏洞:设备被移除后行已删,但靠残留 access token + 连接时回退「账户级 dp_uuid」
还能连上(EnsureDeviceDpUUID 找不到设备→回退),且不计入活跃设备数,绕过设备上限。
修:ConnectNode 去掉账户级回退。设备未注册/已被移除(EnsureDeviceDpUUID 返回
ErrDeviceNotFound)→ 403 {code:DEVICE_NOT_REGISTERED} + 提示「请重新登录以重新
注册设备」。客户端现有 ConnectApiException 处理会把该 message_zh 显示在连接页,
用户重新登录即重新注册(并命中登录挡板/超限流程)。
- nodes: 新增哨兵 ErrDeviceNotFound;EnsureDeviceDpUUID 包装它
- httpapi ConnectNode: errors.Is(ErrDeviceNotFound) → 拒连;其余错误 500
go build/vet 干净;nodes/httpapi 测试全过。客户端不用改。
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Pangolin Server
Go 后端控制面,负责账户、套餐、激活码、设备与节点目录管理。架构详见 ../design/server/ARCHITECTURE.md。
目录结构
server/
├── cmd/
│ ├── server/ # HTTP 服务入口(chi router,/healthz,/v1 挂载归 1d)
│ └── migrate/ # 数据库迁移 CLI 入口(实现归 1e)
├── internal/
│ ├── config/ # 配置加载(env + 文件,归 1e)
│ ├── store/ # 数据库访问层 Postgres(归 1e)
│ ├── apierr/ # 统一错误体 {code, message_zh, message_en}(归 1f)
│ ├── idgen/ # UUID + Crockford Base32 激活码(归 1f)
│ ├── auth/ # 验证码、argon2id、JWT RS256(归 1c/1d)
│ ├── codes/ # 激活码批次、兑换、审计(归 1d)
│ ├── devices/ # 设备管理(归 1d)
│ ├── nodes/ # 节点目录、connect/disconnect(归 1d)
│ ├── usage/ # 用量统计(归 1d)
│ └── admin/ # 内部管理端(归 1d)
├── Makefile
├── go.mod
├── go.sum
├── tools.go # //go:build tools — 锁定 oapi-codegen / migrate 版本
└── .golangci.yml
常用命令
make build # go build ./...
make test # go test ./...
make vet # go vet ./...
make lint # golangci-lint run ./...
make generate # oapi-codegen 代码生成(1d 填充)
make migrate-up # 执行迁移(1e 填充)
make migrate-down # 回滚迁移(1e 填充)
# 快速启动(默认监听 :8080)
go run ./cmd/server
# 指定地址
go run ./cmd/server -addr :9090
# 或通过环境变量
ADDR=:9090 go run ./cmd/server