refactor(plugins): complete physical encapsulation of auth, admin, message_gateway, and risk_control domain plugins

This commit is contained in:
ryan
2026-08-28 07:15:17 +08:00
parent e750fadacd
commit b259f35bb4
51 changed files with 9735 additions and 42 deletions
+6 -4
View File
@@ -1,3 +1,6 @@
// Copyright 2026 Arctel.net
// SPDX-License-Identifier: Apache-2.0
// Package risk_control provides the access control, IP rate limiting, and telemetry risk analysis domain plugin for Cordis.
package risk_control
@@ -6,7 +9,6 @@ import (
"github.com/Rain-kl/Wavelet/core"
"github.com/Rain-kl/Wavelet/core/extpoints"
"github.com/Rain-kl/Wavelet/internal/apps/risk_control"
"github.com/gin-gonic/gin"
)
@@ -54,12 +56,12 @@ func (p *Plugin) Manifest() core.Manifest {
// Apply registers risk control middlewares, settings, and cleanup hooks into the Context.
func (p *Plugin) Apply(ctx *core.Context) error {
// 1. Initialize LogWriter if needed
risk_control.InitLogWriter(ctx.GoContext())
InitLogWriter(ctx.GoContext())
// 2. Register router middleware
mw := p.middleware
if mw == nil {
mw = risk_control.RiskControlMiddleware()
mw = RiskControlMiddleware()
}
ctx.Router().Use(mw)
@@ -81,7 +83,7 @@ func (p *Plugin) Apply(ctx *core.Context) error {
// 4. Register lifecycle disposal cleanup
ctx.OnDispose(func() error {
return risk_control.StopLogWriter(context.Background())
return StopLogWriter(context.Background())
})
return nil