Skip to content
hmzzrcs edited this page Jul 18, 2019 · 4 revisions

此项目用于goku网关的插件开发

插件接口

项目内plugin.go文件定义了四个interface一个struct

type PluginObj struct {
	BeforeMatch PluginBeforeMatch
	Access      PluginAccess
	Proxy       PluginProxy
}
type PluginFactory interface {
	Create(config string, clusterName string, updateTag string, strategyId string, apiId int) (*PluginObj, error)
}

type PluginBeforeMatch interface {
	BeforeMatch(ctx ContextBeforeMatch) (isContinue bool, e error)
}

type PluginAccess interface {
	Access(ctx ContextAccess) (isContinue bool, e error)
}

type PluginProxy interface {
	Proxy(ctx ContextProxy) (isContinue bool, e error)
}

其中,PluginFactory 为插件必须实现的工厂接口,用于给对应作用域创建插件实例,

Clone this wiki locally