rpc

package
v0.0.0-...-58a2b35 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Port = 8080
	// Server = false //是否开启RPC true 开启 false 关闭
	//	Allowip  = "127.0.0.1"  //添加rpc ip地址白名单,为空则所有连接可用。
	Allowip = "" //添加rpc ip地址白名单,为空则所有连接可用。

)

Functions

func GetRPCHandlers

func GetRPCHandlers() *sync.Map

获取RPC的Handlers

func RegisterRPC

func RegisterRPC(rpcName string, handler ServerHandler)

func RemoveRegisterRPC

func RemoveRegisterRPC(rpcNames ...string)

移除已注册的handler 缺省移除全部,有参数则移除指定handler

func Route

func Route(rh model.RpcHandler, w http.ResponseWriter, r *http.Request) (res []byte, err error)

func StopService

func StopService(rj *model.RpcJson, w http.ResponseWriter, r *http.Request) (res []byte, err error)

关闭服务

func UploadFile

func UploadFile(rh model.RpcHandler) (res []byte, err error)

上传文件

Types

type Bind

type Bind struct {
	beego.Controller
}

func (*Bind) Index

func (i *Bind) Index()

type Handler

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

func (*Handler) Err

func (h *Handler) Err(code, data string)

func (*Handler) GetBody

func (h *Handler) GetBody() []byte

func (*Handler) Out

func (h *Handler) Out(data []byte)

func (*Handler) RemoteIp

func (h *Handler) RemoteIp() string

func (*Handler) ServeHTTP

func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request)

func (*Handler) SetBody

func (h *Handler) SetBody(data []byte)

func (*Handler) Validate

func (h *Handler) Validate() (msg string, ok bool)

type ServerHandler

type ServerHandler func(rj *model.RpcJson, w http.ResponseWriter, r *http.Request) ([]byte, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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