mirror of
https://github.com/shadow1ng/fscan.git
synced 2026-09-24 20:21:52 +08:00
feat: 统一服务缓存 + 指纹驱动插件匹配
将 webServiceCache 扩展为通用 serviceCache,所有指纹识别结果 统一缓存,插件匹配时端口不命中则回退到服务名称匹配。 删除多余的 service_cache.go,复用已有的 ServiceInfo 体系。 补充 nil 防御、Explicit 标记、大量单元/集成/回归测试。
This commit is contained in:
@@ -440,9 +440,9 @@ func TestCreateTargetFromURL(t *testing.T) {
|
||||
// TestWebServiceCache 测试Web服务缓存操作
|
||||
func TestWebServiceCache(t *testing.T) {
|
||||
// 清空缓存
|
||||
webCacheMutex.Lock()
|
||||
webServiceCache = make(map[string]*ServiceInfo)
|
||||
webCacheMutex.Unlock()
|
||||
serviceCacheMutex.Lock()
|
||||
serviceCache = make(map[string]*ServiceInfo)
|
||||
serviceCacheMutex.Unlock()
|
||||
|
||||
t.Run("存储和读取", func(t *testing.T) {
|
||||
serviceInfo := &ServiceInfo{
|
||||
@@ -517,9 +517,9 @@ func TestWebServiceCache(t *testing.T) {
|
||||
// TestWebServiceCache_Concurrent 测试并发安全性
|
||||
func TestWebServiceCache_Concurrent(t *testing.T) {
|
||||
// 清空缓存
|
||||
webCacheMutex.Lock()
|
||||
webServiceCache = make(map[string]*ServiceInfo)
|
||||
webCacheMutex.Unlock()
|
||||
serviceCacheMutex.Lock()
|
||||
serviceCache = make(map[string]*ServiceInfo)
|
||||
serviceCacheMutex.Unlock()
|
||||
|
||||
t.Run("不同key并发写入", func(t *testing.T) {
|
||||
var wg sync.WaitGroup
|
||||
|
||||
Reference in New Issue
Block a user