diff --git a/main.go b/main.go index 5eafc29..46b7483 100644 --- a/main.go +++ b/main.go @@ -8,7 +8,6 @@ import ( "SamWaf/innerbean" "SamWaf/model" "SamWaf/model/wafenginmodel" - "SamWaf/plugin" "SamWaf/utils" "SamWaf/utils/zlog" "SamWaf/wafconfig" @@ -19,6 +18,7 @@ import ( "SamWaf/wafsafeclear" "SamWaf/wafsnowflake" "SamWaf/waftask" + "SamWaf/webplugin" "crypto/tls" _ "embed" "fmt" @@ -394,7 +394,7 @@ func (m *wafSystenService) run() { break case enums.ChanTypeAnticc: globalobj.GWAF_RUNTIME_OBJ_WAF_ENGINE.HostTarget[globalobj.GWAF_RUNTIME_OBJ_WAF_ENGINE.HostCode[msg.HostCode]].Mux.Lock() - globalobj.GWAF_RUNTIME_OBJ_WAF_ENGINE.HostTarget[globalobj.GWAF_RUNTIME_OBJ_WAF_ENGINE.HostCode[msg.HostCode]].PluginIpRateLimiter = plugin.NewIPRateLimiter(rate.Limit(msg.Content.(model.AntiCC).Rate), msg.Content.(model.AntiCC).Limit) + globalobj.GWAF_RUNTIME_OBJ_WAF_ENGINE.HostTarget[globalobj.GWAF_RUNTIME_OBJ_WAF_ENGINE.HostCode[msg.HostCode]].PluginIpRateLimiter = webplugin.NewIPRateLimiter(rate.Limit(msg.Content.(model.AntiCC).Rate), msg.Content.(model.AntiCC).Limit) zlog.Debug("远程配置", zap.Any("Anticc", msg.Content.(model.AntiCC))) globalobj.GWAF_RUNTIME_OBJ_WAF_ENGINE.HostTarget[globalobj.GWAF_RUNTIME_OBJ_WAF_ENGINE.HostCode[msg.HostCode]].Mux.Unlock() break diff --git a/model/wafenginmodel/hostsafe.go b/model/wafenginmodel/hostsafe.go index 698877f..4986293 100644 --- a/model/wafenginmodel/hostsafe.go +++ b/model/wafenginmodel/hostsafe.go @@ -2,10 +2,10 @@ package wafenginmodel import ( "SamWaf/model" - "SamWaf/plugin" "SamWaf/utils" "SamWaf/wafenginecore/loadbalance" "SamWaf/wafproxy" + "SamWaf/webplugin" "sync" ) @@ -17,10 +17,10 @@ type HostSafe struct { RuleData []model.Rules RuleVersionSum int //规则版本的汇总 通过这个来进行版本动态加载 Host model.Hosts - PluginIpRateLimiter *plugin.IPRateLimiter //ip限流 - IPWhiteLists []model.IPAllowList //ip 白名单 - UrlWhiteLists []model.URLAllowList //url 白名单 - LdpUrlLists []model.LDPUrl //url 隐私保护 + PluginIpRateLimiter *webplugin.IPRateLimiter //ip限流 + IPWhiteLists []model.IPAllowList //ip 白名单 + UrlWhiteLists []model.URLAllowList //url 白名单 + LdpUrlLists []model.LDPUrl //url 隐私保护 IPBlockLists []model.IPBlockList //ip 黑名单 UrlBlockLists []model.URLBlockList //url 黑名单 diff --git a/wafdb/localdb.go b/wafdb/localdb.go index 0159ddd..735eb2f 100644 --- a/wafdb/localdb.go +++ b/wafdb/localdb.go @@ -19,8 +19,8 @@ import ( "path/filepath" "time" - //"github.com/kangarooxin/gorm-plugin-crypto" - //"github.com/kangarooxin/gorm-plugin-crypto/strategy" + //"github.com/kangarooxin/gorm-webplugin-crypto" + //"github.com/kangarooxin/gorm-webplugin-crypto/strategy" gowxsqlite3 "github.com/pengge/go-wxsqlite3" "github.com/pengge/sqlitedriver" "gorm.io/gorm" diff --git a/wafenginecore/wafengine.go b/wafenginecore/wafengine.go index 3a1d271..15a1744 100644 --- a/wafenginecore/wafengine.go +++ b/wafenginecore/wafengine.go @@ -9,12 +9,12 @@ import ( "SamWaf/model/baseorm" "SamWaf/model/detection" "SamWaf/model/wafenginmodel" - "SamWaf/plugin" "SamWaf/service/waf_service" "SamWaf/utils" "SamWaf/utils/zlog" "SamWaf/wafenginecore/loadbalance" "SamWaf/wafproxy" + "SamWaf/webplugin" "bufio" "bytes" "compress/flate" @@ -770,9 +770,9 @@ func (waf *WafEngine) LoadHost(inHost model.Hosts) innerbean.ServerRunTime { global.GWAF_LOCAL_DB.Where("host_code=? ", inHost.Code).Limit(1).Find(&anticcBean) //初始化插件-ip计数器 - var pluginIpRateLimiter *plugin.IPRateLimiter + var pluginIpRateLimiter *webplugin.IPRateLimiter if anticcBean.Id != "" { - pluginIpRateLimiter = plugin.NewIPRateLimiter(rate.Limit(anticcBean.Rate), anticcBean.Limit) + pluginIpRateLimiter = webplugin.NewIPRateLimiter(rate.Limit(anticcBean.Rate), anticcBean.Limit) } //查询ip白名单 diff --git a/plugin/ipratelimiter.go b/webplugin/ipratelimiter.go similarity index 98% rename from plugin/ipratelimiter.go rename to webplugin/ipratelimiter.go index d1c00b2..1303656 100644 --- a/plugin/ipratelimiter.go +++ b/webplugin/ipratelimiter.go @@ -1,4 +1,4 @@ -package plugin +package webplugin import ( "sync" diff --git a/plugin/modeltenant.go b/webplugin/modeltenant.go similarity index 78% rename from plugin/modeltenant.go rename to webplugin/modeltenant.go index f21b6ac..30d9a5b 100644 --- a/plugin/modeltenant.go +++ b/webplugin/modeltenant.go @@ -1,4 +1,4 @@ -package plugin +package webplugin import ( "gorm.io/gorm"