Files
xingrin/server
yyhuni 3a6d8775a4 chore: update CI workflows and add new test configurations
- Added a new test workflow to run comprehensive tests for the worker, server, and agent components.
- Updated the main CI configuration to include the new test workflow.
- Added a new Makefile for the agent to manage build, run, test, and lint tasks.
- Updated .gitignore to exclude additional IDE files.
- Removed redundant test steps from the CI configuration for cleaner execution.
2026-02-02 23:25:09 +08:00
..
2026-01-15 16:19:00 +08:00
2026-01-15 16:19:00 +08:00
2026-01-15 16:19:00 +08:00
2026-01-15 16:19:00 +08:00

Go Backend

Python Django 后端的 Go 重写版本。

技术栈

组件 选择
Web 框架 Gin
ORM GORM
配置 Viper
日志 Zap
认证 JWT (bcrypt)

迁移进度

已完成

模块 说明
项目基础 目录结构、配置管理、数据库连接、日志
数据模型 全部 33 个模型,含索引和约束
JWT 认证 登录、刷新、中间件
用户 API 创建、列表、修改密码
组织 API 完整 CRUD软删除
目标 API 完整 CRUD软删除、类型自动检测
引擎 API 完整 CRUD

🚧 待实现

模块 优先级 说明
Scan API 扫描管理(发起、状态、结果)
Asset API 资产查询(子域名、端口、漏洞等)
Worker 扫描任务执行(核心逻辑)
定时任务 定时扫描
通知 扫描完成通知
统计 资产统计

技术债务

项目 说明 优先级
Context 传递 Repository/Service 加 context 参数
单元测试 Handler/Service 层测试
接口抽象 Repository 接口化(便于 mock
泛型重构 通用 Repository等模块多了再做

运行

# 开发
make run

# 测试
make test

# 构建
make build

API 端点

POST   /api/auth/login          # 登录
POST   /api/auth/refresh        # 刷新 token
GET    /api/auth/me             # 当前用户

POST   /api/users               # 创建用户
GET    /api/users               # 用户列表
PUT    /api/users/password      # 修改密码

GET    /api/organizations       # 组织列表
POST   /api/organizations       # 创建组织
GET    /api/organizations/:id   # 获取组织
PUT    /api/organizations/:id   # 更新组织
DELETE /api/organizations/:id   # 删除组织

GET    /api/targets             # 目标列表
POST   /api/targets             # 创建目标
GET    /api/targets/:id         # 获取目标
PUT    /api/targets/:id         # 更新目标
DELETE /api/targets/:id         # 删除目标

GET    /api/engines             # 引擎列表
POST   /api/engines             # 创建引擎
GET    /api/engines/:id         # 获取引擎
PUT    /api/engines/:id         # 更新引擎
DELETE /api/engines/:id         # 删除引擎