jsonrpc

package
v0.0.0-...-7be72bc Latest Latest
Warning

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

Go to latest
Published: Sep 2, 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

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