plugin

package
v0.34.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	APIVersion = "0.1.0"

	OpLogin       = "Login"
	OpNewProxy    = "NewProxy"
	OpPing        = "Ping"
	OpNewWorkConn = "NewWorkConn"
	OpNewUserConn = "NewUserConn"
)

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) NewUserConn added in v0.33.0

func (m *Manager) NewUserConn(content *NewUserConnContent) (*NewUserConnContent, error)

func (*Manager) NewWorkConn added in v0.32.1

func (m *Manager) NewWorkConn(content *NewWorkConnContent) (*NewWorkConnContent, error)

func (*Manager) Ping added in v0.32.1

func (m *Manager) Ping(content *PingContent) (*PingContent, error)

func (*Manager) Register

func (m *Manager) Register(p Plugin)

type NewProxyContent

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

type NewUserConnContent added in v0.33.0

type NewUserConnContent struct {
	User       UserInfo `json:"user"`
	ProxyName  string   `json:"proxy_name"`
	ProxyType  string   `json:"proxy_type"`
	RemoteAddr string   `json:"remote_addr"`
}

type NewWorkConnContent added in v0.32.1

type NewWorkConnContent struct {
	User UserInfo `json:"user"`
	msg.NewWorkConn
}

type PingContent added in v0.32.1

type PingContent struct {
	User UserInfo `json:"user"`
	msg.Ping
}

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"`
	RunID string            `json:"run_id"`
}

Jump to

Keyboard shortcuts

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