基础的插件注册+获取+调度能力, 待完善

This commit is contained in:
2024-11-13 18:26:47 +08:00
parent 942cd1dfed
commit 507f1f5090
4 changed files with 161 additions and 3 deletions

View File

@ -0,0 +1,32 @@
// Package abstract ...
//
// Description : plugins ...
//
// Author : go_developer@163.com<白茶清欢>
//
// Date : 2024-11-13 16:21
package abstract
import (
"git.zhangdeman.cn/gateway/core/define"
)
// IPlugin 插件全局接口约束
//
// Author : go_developer@163.com<白茶清欢>
//
// Date : 16:22 2024/11/13
type IPlugin interface {
// ID 插件ID, 全局唯一, 不允许重复
ID() string
// Description 插件描述,描述插件的作用
Description() string
// Config 读取插件的配置
Config() (map[string]any, error)
// Allow 插件是否允许执行
Allow() bool
// SkipFailure 插件执行失败, 是否跳过
SkipFailure() bool
// Logic 插件执行的逻辑
Logic(rc *define.RequestContext, cfg map[string]any) *define.PluginResult
}