Help us shape the future of Go! Take the 2026 Go Developer Survey

plugin

package
v1.1.9 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2025 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	APIVersion = "0.1.0"

	OpLogin       = "Login"
	OpNewProxy    = "NewProxy"
	OpCloseProxy  = "CloseProxy"
	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 CloseProxyContent

type CloseProxyContent struct {
	User UserInfo `json:"user"`
	msg.CloseProxy
}

type LoginContent

type LoginContent struct {
	msg.Login

	ClientAddress string `json:"client_address,omitempty"`
}

type Manager

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

func NewManager

func NewManager() *Manager

func (*Manager) CloseProxy

func (m *Manager) CloseProxy(content *CloseProxyContent) error

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

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

func (*Manager) NewWorkConn

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

func (*Manager) Ping

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

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

type NewWorkConnContent

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

type PingContent

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 any) (res *Response, retContent any, err error)
}

func NewHTTPPluginOptions

func NewHTTPPluginOptions(options v1.HTTPPluginOptions) Plugin

type Request

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

type Response

type Response struct {
	Reject       bool   `json:"reject"`
	RejectReason string `json:"reject_reason"`
	Unchange     bool   `json:"unchange"`
	Content      any    `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