diff --git a/plugins/local/types.go b/plugins/local/types.go index e5afbb3..3832761 100644 --- a/plugins/local/types.go +++ b/plugins/local/types.go @@ -20,8 +20,7 @@ type ScanResult = plugins.Result // 向后兼容的函数 func RegisterLocalPlugin(name string, creator func() Plugin) { plugins.Register(name, func() plugins.Plugin { - localPlugin := creator() - return &localPluginAdapter{localPlugin} + return creator() }) } @@ -33,18 +32,6 @@ func GetAllLocalPlugins() []string { // 注意:GetLocalPlugin函数已移除,因为它总是返回nil没有任何意义 // 如需获取插件实例,请直接使用 plugins.Get(name) -// 适配器:将Local插件转换为统一插件接口 -type localPluginAdapter struct { - localPlugin Plugin -} - -func (a *localPluginAdapter) Name() string { - return a.localPlugin.Name() -} - -func (a *localPluginAdapter) Scan(ctx context.Context, info *common.HostInfo) *plugins.Result { - return a.localPlugin.Scan(ctx, info) -} // 保留的工具函数 func GetSystemInfo() string { diff --git a/plugins/services/types.go b/plugins/services/types.go index a4309bf..cf8d56e 100644 --- a/plugins/services/types.go +++ b/plugins/services/types.go @@ -21,7 +21,7 @@ type Credential = plugins.Credential // RegisterPluginWithPorts 高效注册:直接传递端口信息,避免实例创建 func RegisterPluginWithPorts(name string, factory func() Plugin, ports []int) { plugins.RegisterWithPorts(name, func() plugins.Plugin { - return &servicePluginAdapter{factory()} + return factory() }, ports) } @@ -36,15 +36,3 @@ func GetAllPlugins() []string { var GenerateCredentials = plugins.GenerateCredentials -// 适配器:将services插件转换为统一插件接口 -type servicePluginAdapter struct { - servicePlugin Plugin -} - -func (a *servicePluginAdapter) Name() string { - return a.servicePlugin.Name() -} - -func (a *servicePluginAdapter) Scan(ctx context.Context, info *common.HostInfo) *plugins.Result { - return a.servicePlugin.Scan(ctx, info) -} \ No newline at end of file diff --git a/plugins/web/types.go b/plugins/web/types.go index 02d8378..84eecf1 100644 --- a/plugins/web/types.go +++ b/plugins/web/types.go @@ -18,7 +18,7 @@ type WebScanResult = plugins.Result // 向后兼容的函数 func RegisterWebPlugin(name string, creator func() WebPlugin) { plugins.Register(name, func() plugins.Plugin { - return &webPluginAdapter{creator()} + return creator() }) } @@ -26,15 +26,3 @@ func GetAllWebPlugins() []string { return plugins.All() } -// 适配器:将Web插件转换为统一插件接口 -type webPluginAdapter struct { - webPlugin WebPlugin -} - -func (a *webPluginAdapter) Name() string { - return a.webPlugin.Name() -} - -func (a *webPluginAdapter) Scan(ctx context.Context, info *common.HostInfo) *plugins.Result { - return a.webPlugin.Scan(ctx, info) -} \ No newline at end of file