proxy

package
v0.0.0-...-bb0bcea Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2025 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetBasicAuthDecoded

func GetBasicAuthDecoded(header string) (string, string, error)

func SetToReqCtx

func SetToReqCtx(ctx *fasthttp.RequestCtx, setter func(*ReqCtx))

SetToReqCtx retrieves the ReqCtx from fasthttp.RequestCtx, applies the provided setter, and stores it back.

Types

type Balancer

type Balancer interface {
	Borrow() (balancer.Payload, balancer.Release)
}

type JSONRPCError

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

JSONRPCError json-rpc error spec struct.

type JSONRPCRequest

type JSONRPCRequest struct {
	Method string `json:"method"`
}

JSONRPCRequest json-rpc request spec struct with method field.

type JSONRPCResponse

type JSONRPCResponse struct {
	Error JSONRPCError `json:"error"`
}

JSONRPCResponse json-rpc response spec struct with error field.

func (*JSONRPCResponse) HasError

func (j *JSONRPCResponse) HasError() bool

HasError return false if JSONRPCResponse Error field is empty.

type ReqCtx

type ReqCtx struct {
	Request  []JSONRPCRequest  // json-rpc request from client
	Response []JSONRPCResponse // json-rpc response from node

	ConnURL string // provider connection url choiced by balanacer

	Balancer string // load balancing algorithm for request
	Client   string // login from basic auth
	ChainID  int64  // chainID from path
	RPCName  string // rpc name from config
	Provider string // provider from config

	Latency       float64 // request latency
	IsClientError bool    // true if response contains user user
}

ReqCtx carries request-scoped metadata used for metrics and logging. It is progressively filled by middlewares during request handling.

func GetReqCtx

func GetReqCtx(ctx *fasthttp.RequestCtx) *ReqCtx

GetReqCtx returns the ReqCtx from fasthttp.RequestCtx. If none exists, a new one is created.

func (*ReqCtx) SetToCtx

func (r *ReqCtx) SetToCtx(ctx *fasthttp.RequestCtx)

SetToCtx stores the ReqCtx in the given fasthttp.RequestCtx.

type Server

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

func New

func New(cfg config.Config) *Server

func (*Server) Start

func (srv *Server) Start(ctx context.Context)

func (*Server) Stop

func (srv *Server) Stop()

type WSContext

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

type WSHandler

type WSHandler func(ctx *WSContext)

Jump to

Keyboard shortcuts

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