jsonrpc2

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: May 29, 2021 License: MIT Imports: 15 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.

func NewServer added in v0.2.0

func NewServer(appl app.Appl, authn apix.Authn, cfg Config) *http.ServeMux

NewServer creates and returns HTTP handler with JSON-RPC 2.0 service on given cfg.Pattern.

Types

type Config

type Config struct {
	Pattern   string // Pattern for http.ServeMux.
	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 (*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