messages

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: 13 Imported by: 0

README

跟TeaWeb主线程交互说明

接收

  • Start - 启动插件
  • Stop - 停止插件
  • Reload - 刷新插件
  • ReloadApp - 刷新单个App
  • FilterRequest - 过滤HTTP请求
  • FilterResponse - 过滤HTTP响应

发送

  • Register - 注册插件
  • ReloadApps - 刷新插件相关的所有Apps
  • ReloadApp - 刷新单个App
  • FilterRequest - 过滤HTTP请求结果
  • FilterResponse - 过滤HTTP响应结果

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ActionQueue = NewQueue()

Functions

func NewAction

func NewAction(action string) interface{}

func RegisterAction

func RegisterAction(actionPtr ...interface{})

func Unmarshal

func Unmarshal(action string, data []byte) (interface{}, error)

Types

type Action

type Action struct {
	// contains filtered or unexported fields
}

func (*Action) MessageId

func (this *Action) MessageId() uint32

func (*Action) Name

func (this *Action) Name() string

func (*Action) SetMessageId

func (this *Action) SetMessageId(messageId uint32)

func (*Action) SetTime

func (this *Action) SetTime(t time.Time)

func (*Action) Time

func (this *Action) Time() time.Time

type ActionInterface

type ActionInterface interface {
	Name() string
	SetMessageId(messageId uint32)
	MessageId() uint32
	SetTime(t time.Time)
	Time() time.Time
}

type EmptyAction

type EmptyAction struct {
	Action
}

func (*EmptyAction) Name

func (this *EmptyAction) Name() string

type FilterRequestAction

type FilterRequestAction struct {
	Action

	Continue bool
	Data     []byte
}

func (*FilterRequestAction) Name

func (this *FilterRequestAction) Name() string

func (*FilterRequestAction) Request

func (this *FilterRequestAction) Request() (*http.Request, error)

type FilterResponseAction

type FilterResponseAction struct {
	Action

	Continue bool
	Data     []byte
}

func (*FilterResponseAction) Name

func (this *FilterResponseAction) Name() string

func (*FilterResponseAction) Response

func (this *FilterResponseAction) Response() (*http.Response, error)

type LoadAction

type LoadAction struct {
	Action
}

func (*LoadAction) Name

func (this *LoadAction) Name() string

type Message

type Message struct {
	Id     uint32
	Action string
	Value  interface{}
}

func NewActionMessage

func NewActionMessage(action ActionInterface) *Message

func NewMessage

func NewMessage() *Message

func (*Message) Marshal

func (this *Message) Marshal() ([]byte, error)

type Queue

type Queue struct {
	Timeout time.Duration
	// contains filtered or unexported fields
}

func NewQueue

func NewQueue() *Queue

func (*Queue) Notify

func (this *Queue) Notify(resp ActionInterface)

func (*Queue) Wait

func (this *Queue) Wait(action ActionInterface) (respAction ActionInterface)

type RegisterPluginAction

type RegisterPluginAction struct {
	Action

	Plugin *plugins.Plugin
}

func (*RegisterPluginAction) Name

func (this *RegisterPluginAction) Name() string

type ReloadAction

type ReloadAction struct {
	Action
}

func (*ReloadAction) Name

func (this *ReloadAction) Name() string

type ReloadAppAction

type ReloadAppAction struct {
	Action

	App *apps.App
}

func (*ReloadAppAction) Name

func (this *ReloadAppAction) Name() string

type ReloadAppsAction

type ReloadAppsAction struct {
	Action

	Apps []*apps.App
}

func (*ReloadAppsAction) Name

func (this *ReloadAppsAction) Name() string

type StartAction

type StartAction struct {
	Action
}

func (*StartAction) Name

func (this *StartAction) Name() string

type StopAction

type StopAction struct {
	Action
}

func (*StopAction) Name

func (this *StopAction) Name() string

Jump to

Keyboard shortcuts

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