refactor: 引入 ScanSession,替代全局状态穿透扫描管道 (Phase 1-3)

- 新增 common/session.go: ScanSession 结构体封装 Config/State/Params/Dialer
- RunScan/Strategy/ExecuteScanTasks/executeScanTask 全部接收 session
- Plugin 接口从 Scan(ctx, info, config, state) 改为 Scan(ctx, info, session)
- 48 个插件实现统一更新签名
- Web API 构建 ScanSession 传给 RunScan
- CLI 模式通过 Initialize() 创建 session
This commit is contained in:
ZacharyZcR
2026-04-27 23:00:06 +08:00
parent 3d7cdcbe5f
commit a865e5d45e
62 changed files with 283 additions and 89 deletions
+5 -2
View File
@@ -206,9 +206,12 @@ func (h *ScanHandler) runScan(req ScanRequest) {
fv.DisableSave = true // Web模式不保存到文件
fv.Silent = true // 静默模式
// 构建Config,同步到全局实例供 network/限速等模块使用
// 构建Config和Session
config := common.BuildConfigFromFlags(fv)
state := common.NewState()
session := common.NewScanSession(config, state, fv)
// 过渡桥:全局状态同步(待 Phase 5 移除)
common.SetGlobalConfig(config)
common.SetGlobalState(state)
@@ -221,7 +224,7 @@ func (h *ScanHandler) runScan(req ScanRequest) {
})
// 执行扫描
core.RunScan(ctx, info, config, state)
core.RunScan(ctx, info, session)
}
// Stop 停止扫描