jsonrpc2

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package jsonrpc2 implements JSON-RPC 2.0 method handlers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitMetrics

func InitMetrics(reg *prometheus.Registry)

InitMetrics must be called once before using this package. It registers and initializes metrics used by this package.

Types

type Config

type Config struct {
	StrictErr bool // Set to true to panic if RPC method returns undocumented error.
}

Config contains configuration for JSON-RPC 2.0 service.

type Ctx

type Ctx = context.Context

Ctx is a synonym for convenience.

type Server

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

Server implements JSON-RPC 2.0 method handlers.

func New

func New(appl app.Appl, authn apix.Authn, cfg Config) *Server

New creates new net/rpc service.

func (*Server) Example

func (srv *Server) Example(arg api.RPCExampleReq, res *api.RPCExampleResp) error

Example implements JSON-RPC 2.0 method.

func (*Server) IncExample

func (srv *Server) IncExample(arg api.RPCIncExampleReq, res *api.RPCIncExampleResp) error

IncExample implements JSON-RPC 2.0 method.

Jump to

Keyboard shortcuts

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