optimize plugin sdk (#1930)

This commit is contained in:
澄潭
2025-03-22 22:46:37 +08:00
committed by GitHub
parent 1812a6b0a9
commit 45fbc8b084
117 changed files with 1036 additions and 766 deletions

View File

@@ -24,6 +24,7 @@ import (
"api-workflow/utils"
. "api-workflow/workflow"
"github.com/alibaba/higress/plugins/wasm-go/pkg/log"
"github.com/alibaba/higress/plugins/wasm-go/pkg/wrapper"
"github.com/higress-group/proxy-wasm-go-sdk/proxywasm"
"github.com/higress-group/proxy-wasm-go-sdk/proxywasm/types"
@@ -44,7 +45,7 @@ func main() {
)
}
func parseConfig(json gjson.Result, c *PluginConfig, log wrapper.Log) error {
func parseConfig(json gjson.Result, c *PluginConfig, log log.Log) error {
edges := make([]Edge, 0)
nodes := make(map[string]Node)
@@ -174,7 +175,7 @@ func initWorkflowExecStatus(config *PluginConfig) (map[string]int, error) {
return result, nil
}
func onHttpRequestBody(ctx wrapper.HttpContext, config PluginConfig, body []byte, log wrapper.Log) types.Action {
func onHttpRequestBody(ctx wrapper.HttpContext, config PluginConfig, body []byte, log log.Log) types.Action {
initHeader := make([][2]string, 0)
// 初始化运行状态
@@ -199,7 +200,7 @@ func onHttpRequestBody(ctx wrapper.HttpContext, config PluginConfig, body []byte
}
// 放入符合条件的edge
func recursive(edge Edge, headers [][2]string, body []byte, depth uint32, config PluginConfig, log wrapper.Log, ctx wrapper.HttpContext) error {
func recursive(edge Edge, headers [][2]string, body []byte, depth uint32, config PluginConfig, log log.Log, ctx wrapper.HttpContext) error {
var err error
// 防止递归次数太多