Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var HandshakeConfig = plugin.HandshakeConfig{
ProtocolVersion: 1,
MagicCookieKey: "SAGOO_PLUGIN",
MagicCookieValue: "sagoo_plugin",
}
HandshakeConfig 握手配置,插件进程和宿主机进程,都需要保持一致
Functions ¶
func OutJsonRes ¶
OutJsonRes 输出json字符串结果
Types ¶
type Notice ¶
type Notice interface { Info() model.PluginInfo Send(data []byte) model.JsonRes }
Notice 通知服务插件接口
type NoticePlugin ¶
type NoticePlugin struct{}
NoticePlugin 插件的虚拟实现。用于PluginMap的插件接口。在运行时,来自插件实现的实际实现会覆盖
type NoticeRPC ¶
NoticeRPC 基于RPC实现
func (*NoticeRPC) Info ¶
func (g *NoticeRPC) Info() model.PluginInfo
type NoticeRPCServer ¶
type NoticeRPCServer struct {
Impl Notice
}
NoticeRPCServer GreeterRPC的RPC服务器,符合 net/rpc的要求
func (*NoticeRPCServer) Info ¶
func (s *NoticeRPCServer) Info(args interface{}, resp *model.PluginInfo) error
type Protocol ¶
type Protocol interface { Info() model.PluginInfo Encode(args interface{}) model.JsonRes Decode(data model.DataReq) model.JsonRes }
Protocol 协议解析插件接口
type ProtocolPlugin ¶
type ProtocolPlugin struct{}
ProtocolPlugin 插件的虚拟实现。用于PluginMap的插件接口。在运行时,来自插件实现的实际实现会覆盖
type ProtocolRPC ¶
ProtocolRPC 基于RPC实现
func (*ProtocolRPC) Decode ¶ added in v1.0.3
func (p *ProtocolRPC) Decode(data model.DataReq) model.JsonRes
func (*ProtocolRPC) Encode ¶ added in v1.0.3
func (p *ProtocolRPC) Encode(args interface{}) model.JsonRes
func (*ProtocolRPC) Info ¶
func (p *ProtocolRPC) Info() model.PluginInfo
type ProtocolRPCServer ¶
type ProtocolRPCServer struct { // 内嵌业务接口 // 插件进程会将实现业务接口的对象赋值给Impl Impl Protocol }
ProtocolRPCServer GreeterRPC的RPC服务器,符合 net/rpc的要求
func (*ProtocolRPCServer) Encode ¶ added in v1.0.3
func (s *ProtocolRPCServer) Encode(args interface{}, resp *model.JsonRes) error
func (*ProtocolRPCServer) Info ¶
func (s *ProtocolRPCServer) Info(args interface{}, resp *model.PluginInfo) error
Click to show internal directories.
Click to hide internal directories.