rpc

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2019 License: BSD-3-Clause Imports: 6 Imported by: 11

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type JSONRPC

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

JSONRPC ...

func (*JSONRPC) Name

func (rpc *JSONRPC) Name() string

Name ...

func (*JSONRPC) NewRequest

func (rpc *JSONRPC) NewRequest(method string, args ...interface{}) Request

NewRequest ...

func (*JSONRPC) NewResponse

func (rpc *JSONRPC) NewResponse(data []byte) Response

NewResponse ...

type JSONRPCError

type JSONRPCError struct {
	Code    int64  `json:"code"`
	Message string `json:"message"`
}

JSONRPCError ...

func (*JSONRPCError) Error

func (err *JSONRPCError) Error() string

type JSONRPCRequest

type JSONRPCRequest struct {
	Version    string        `json:"jsonrpc,omitempty"`
	Method     string        `json:"method"`
	Params     []interface{} `json:"params"`
	Identifier uint64        `json:"id"`
}

JSONRPCRequest ...

func (*JSONRPCRequest) Get

func (req *JSONRPCRequest) Get(key string) interface{}

Get ...

func (*JSONRPCRequest) ID

func (req *JSONRPCRequest) ID() uint64

ID ...

func (*JSONRPCRequest) Set

func (req *JSONRPCRequest) Set(key string, value interface{})

Set ...

func (*JSONRPCRequest) String

func (req *JSONRPCRequest) String() string

String ...

type JSONRPCResponse

type JSONRPCResponse struct {
	Version    string        `json:"jsonrpc"`
	Identifier uint64        `json:"id"`
	Result     interface{}   `json:"result"`
	Err        *JSONRPCError `json:"error,omitempty"`
}

JSONRPCResponse ...

func (*JSONRPCResponse) Error

func (resp *JSONRPCResponse) Error() error

func (*JSONRPCResponse) Get

func (resp *JSONRPCResponse) Get(key string) interface{}

Get ...

func (*JSONRPCResponse) ID

func (resp *JSONRPCResponse) ID() uint64

ID ...

func (*JSONRPCResponse) String

func (resp *JSONRPCResponse) String() string

String ...

type RPC

type RPC interface {
	Name() string
	NewRequest(method string, args ...interface{}) Request
	NewResponse(data []byte) Response
}

RPC defines basic methods of variety RPCs

func GetDefaultMethod

func GetDefaultMethod() RPC

GetDefaultMethod ...

func NewJSONRPC

func NewJSONRPC() RPC

NewJSONRPC ...

type Request

type Request interface {
	Set(key string, value interface{})
	Get(key string) interface{}
	String() string
	ID() uint64
}

Request defines basic methods of an RPC request

type Response

type Response interface {
	Get(key string) interface{}
	String() string
	ID() uint64
	Error() error
}

Response defines basic methods of an RPC response

Jump to

Keyboard shortcuts

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