Documentation
¶
Index ¶
- Variables
- func GetRPCHandlers() *sync.Map
- func RegisterRPC(rpcName string, handler ServerHandler)
- func RemoveRegisterRPC(rpcNames ...string)
- func Route(rh model.RpcHandler, w http.ResponseWriter, r *http.Request) (res []byte, err error)
- func StopService(rj *model.RpcJson, w http.ResponseWriter, r *http.Request) (res []byte, err error)
- func UploadFile(rh model.RpcHandler) (res []byte, err error)
- type Bind
- type Handler
- func (h *Handler) Err(code, data string)
- func (h *Handler) GetBody() []byte
- func (h *Handler) Out(data []byte)
- func (h *Handler) RemoteIp() string
- func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request)
- func (h *Handler) SetBody(data []byte)
- func (h *Handler) Validate() (msg string, ok bool)
- type ServerHandler
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 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 ¶
关闭服务
Types ¶
type ServerHandler ¶
Click to show internal directories.
Click to hide internal directories.