Files
pangolin/server
wangjia 4940278ea5
Deploy Server / deploy-server (push) Successful in 2m55s
Deploy Site / deploy-site (push) Successful in 2m41s
Deploy Client / build-windows (push) Successful in 1m47s
Deploy Client / build-android (push) Successful in 7m39s
Deploy Client / build-macos (push) Successful in 3m40s
Deploy Client / build-ios (push) Successful in 4m48s
Deploy Client / release-deploy (push) Successful in 2m25s
feat(migrate): 用户中心迁到 pangolin.yanmeiai.com/user/ + 域名配置化
原独立子域 app.yanmeiai.com → 主站子路径 /user/(用户选停用旧域名):
- 域名配置化(去硬编码):客户端 kWebUserCenterBaseUrl 收进 api_config.dart
  (dart-define 可覆盖);官网 site.ts、服务端 CORS_ORIGINS 本就是配置
- 用户中心 next.config basePath=/user;layout.tsx 的 /colors_and_type.css 手动
  拼 basePath(public 根绝对资源不自动加前缀,否则 404)
- CI 合并部署:compile-site + compile-usercenter + combine-site(用户中心并入
  dist/user/ + _headers 按 /user/* 分域:官网严格 CSP,用户中心 unsafe-inline+
  connect-src https)→ 单次部署 pangolin-site;删独立 pangolin-usercenter 部署
- 服务端 CORS 默认 origin app.yanmeiai.com → pangolin.yanmeiai.com(+ 测试)
- 客户端 web_launch 走新址 → 随 client-v1.0.62;go test CORS 过、flutter analyze 净

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013nMthbVEmQquxBRKb9Fj8u
2026-07-07 17:33:22 +08:00
..

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