plugins

package
v0.0.0-...-17a5fe9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 16, 2020 License: MIT Imports: 4 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

Types

type Plugin

type Plugin struct {
	Name        string
	Code        string
	Site        string
	Version     string
	Date        string
	Developer   string
	Description string

	Apps []*apps.App

	HasRequestFilter  bool
	HasResponseFilter bool
	// contains filtered or unexported fields
}

插件定义

func NewPlugin

func NewPlugin() *Plugin

构造新的插件对象

func (*Plugin) AddApp

func (this *Plugin) AddApp(app ...*apps.App)

添加App

func (*Plugin) AppWithId

func (this *Plugin) AppWithId(appId string) *apps.App

根据ID获取App

func (*Plugin) FilterRequest

func (this *Plugin) FilterRequest(request *http.Request) bool

调用请求时的回调函数

func (*Plugin) FilterResponse

func (this *Plugin) FilterResponse(response *http.Response) bool

调用发送响应时的回调函数

func (*Plugin) OnReload

func (this *Plugin) OnReload(f func())

设置刷新时回调函数

func (*Plugin) OnReloadApps

func (this *Plugin) OnReloadApps(f func())

刷新apps时回调

func (*Plugin) OnReloadedApps

func (this *Plugin) OnReloadedApps(f func())

已刷新App时回调

func (*Plugin) OnRequest

func (this *Plugin) OnRequest(f func(request *http.Request) bool)

设置请求时的回调函数,如果返回false,则不会往下执行

func (*Plugin) OnResponse

func (this *Plugin) OnResponse(f func(response *http.Response) bool)

设置发送响应时的回调函数,如果返回false,则不会往下执行

func (*Plugin) OnStart

func (this *Plugin) OnStart(f func())

设置启动时回调函数

func (*Plugin) OnStop

func (this *Plugin) OnStop(f func())

设置停止时回调函数

func (*Plugin) Reload

func (this *Plugin) Reload()

刷新插件

func (*Plugin) ReloadApps

func (this *Plugin) ReloadApps()

刷新apps

func (*Plugin) ResetApps

func (this *Plugin) ResetApps()

重置App数据

func (*Plugin) Start

func (this *Plugin) Start()

启动插件

func (*Plugin) Stop

func (this *Plugin) Stop()

停止插件

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL