jsonrpc

package
v0.6.47 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2024 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Overview

Package jsonrpc implements Gin middleware for handling JSON-RPC requests via HTTP.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Controller

func Controller(api interface{}) gin.HandlerFunc

Controller returns a custom Gin middleware that handles incoming JSON-RPC requests via HTTP. It maps the RPC method name to struct methods on the given api. For example, if the RPC request has the method field set to "namespace_methodName" then the controller will make a call to api.Namespace_methodName with the params spread as arguments.

If request is valid it will also set the data on the Gin context with the key "json-rpc-request".

NOTE: For batched requests in the current version, "json-rpc-request" on the Gin context contains only the last request in the array.

func WithOTELTracerAttributes added in v0.6.9

func WithOTELTracerAttributes() gin.HandlerFunc

WithOTELTracerAttributes adds custom opentelemetry attributes relating to the JSON-RPC method call for the current span.

Types

This section is empty.

Jump to

Keyboard shortcuts

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