Documentation ¶
Index ¶
- Constants
- func Call(url string, reqData Request, rpcUser string, rpcPassword string) (interface{}, error)
- func CallArray(url, method string, params ...interface{}) (interface{}, error)
- func CallParams(url, method string, params htp.Params) (interface{}, error)
- type Config
- type Handler
- type Request
- type Response
- type Server
Constants ¶
View Source
const ( // JSON-RPC protocol version. Version = "2.0" // JSON-RPC protocol error codes. ParseError = -32700 InvalidRequest = -32600 MethodNotFound = -32601 InvalidParams = -32602 InternalError = -32603 )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct { Path string ServePort uint16 User string Pass string WhiteList []string NetListen func(port uint16) (net.Listener, error) }
Config is the configuration of the JSON-RPC server.
type Request ¶
type Request struct { Id interface{} `json:"id"` Version string `json:"jsonrpc"` Method string `json:"method"` Params interface{} `json:"params"` }
Request represent the standard JSON-RPC request data structure.
type Response ¶
type Response struct { Id interface{} `json:"id"` Version string `json:"jsonrpc"` Result interface{} `json:"result"` Error *htp.Error `json:"error"` }
Response represent the standard JSON-RPC Response data structure.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is the JSON-RPC server instance class.
func (*Server) RegisterAction ¶
RegisterAction register a service handler method by it's name and parameters. When a JSON-RPC client's request method matches the registered handler name, it will be invoked. This method is safe for concurrency access.
Click to show internal directories.
Click to hide internal directories.