refactor: unify types facade, split into sub-files, fix CI#32
Merged
Conversation
- Split pkg/types/types.go into focused sub-files: scan.go, finger.go, template.go, neutron.go, proton.go (core interfaces stay in types.go) - Add TemplateEvent alias and ReadRaw function to eliminate httputils leak - Fix VulnResult to use package-level aliases instead of direct imports - Refactor neutron.ExecuteResult to embed TypedResult[T] for consistency - Migrate fingers/ and examples/ from httputils.ReadRaw to types.ReadRaw - Fix CI: add L2 module test steps, add replace directives for consumer build - Fix go vet warnings in gogo/spray tests (context leak) - Update deps: fingers, neutron/operators/full, proton, utils to master Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
VulnResult was misleading — it's the JSON-serializable form of any neutron template execution, not just vulnerability findings. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
ExecuteResult now directly wraps TypedResult[*OperatorResult] with events as a separate field. NeutronResult was an unnecessary intermediate layer — OperatorResult already contains the full template execution data. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Context: rename all SetX → WithX across gogo/spray/zombie/proton for consistency with fingers engine convention - Config: rename fingers.Config.SetEnableEngines → WithEnableEngines - ExportFilter: move from pkg/types/ to pkg/cyberhub/ (sole consumer) - finger types: remove internal-only aliases (FingerMapper, FingerFavicons, FingerContent, FingerRegexp, FingersMatchEngine, FingersLibEngine); keep extension points (FingerSender, FingerCallback) - scan types: remove ZombieMod* constants (zombie engine has its own Mode*) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…eanup Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
L1/L2 引擎解耦,types 包统一重构,消除上游类型泄漏。
Breaking Changes
types 包重组
types.VulnResult→types.TemplateResult,方法ExecuteResult.VulnResult()→ExecuteResult.TemplateResult()types.NeutronResult已删除,ExecuteResult.Value()直接返回*types.OperatorResultExecuteResult.Result()已删除,用ExecuteResult.Value()替代ExecuteResult.Events()获取协议级事件L2 引擎模块隔离
gogo/spray/zombie各自独立go.mod,通过go get github.com/chainreactors/sdk/gogo单独引入types包迁移到各自引擎包:types.NewDefaultGogoOption()→gogo.NewDefaultGogoOption()types.SprayOption/types.NewDefaultSprayOption()→spray包内部,外部通过Context配置types.NewDefaultZombieOption()→zombie.NewDefaultOption()New Features
types.go拆为scan.go/finger.go/template.go/neutron.go/proton.gotypes.TemplateEvent别名 +types.ReadRaw函数,消除httputils直接依赖client.Register()/client.Lookup()引擎工厂注册表,L2 引擎init()自注册Dependencies
fingers/neutron/operators/full/proton/utils更新到 masterTest plan
go vet ./...全部模块通过go test ./...全部模块通过 (L1 + gogo + spray + zombie)go build ./...全部模块通过 (含 examples)🤖 Generated with Claude Code