plugin

package
v0.32.2 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2020 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	APIVersion = "0.1.0"

	OpLogin    = "Login"
	OpNewProxy = "NewProxy"
)

Variables

This section is empty.

Functions

func GetReqidFromContext

func GetReqidFromContext(ctx context.Context) string

func NewReqidContext

func NewReqidContext(ctx context.Context, reqid string) context.Context

Types

type HTTPPluginOptions

type HTTPPluginOptions struct {
	Name string
	Addr string
	Path string
	Ops  []string
}

type LoginContent

type LoginContent struct {
	msg.Login
}

type Manager

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

func NewManager

func NewManager() *Manager

func (*Manager) Login

func (m *Manager) Login(content *LoginContent) (*LoginContent, error)

func (*Manager) NewProxy

func (m *Manager) NewProxy(content *NewProxyContent) (*NewProxyContent, error)

func (*Manager) Register

func (m *Manager) Register(p Plugin)

type NewProxyContent

type NewProxyContent struct {
	User UserInfo `json:"user"`
	msg.NewProxy
}

type Plugin

type Plugin interface {
	Name() string
	IsSupport(op string) bool
	Handle(ctx context.Context, op string, content interface{}) (res *Response, retContent interface{}, err error)
}

func NewHTTPPluginOptions

func NewHTTPPluginOptions(options HTTPPluginOptions) Plugin

type Request

type Request struct {
	Version string      `json:"version"`
	Op      string      `json:"op"`
	Content interface{} `json:"content"`
}

type Response

type Response struct {
	Reject       bool        `json:"reject"`
	RejectReason string      `json:"reject_reason"`
	Unchange     bool        `json:"unchange"`
	Content      interface{} `json:"content"`
}

type UserInfo

type UserInfo struct {
	User  string            `json:"user"`
	Metas map[string]string `json:"metas"`
}

Jump to

Keyboard shortcuts

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