api

package
v0.0.0-...-5d7b32d Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2024 License: GPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewRateLimiter

func NewRateLimiter(limit int, lifetime time.Duration) *rateLimiter

Types

type JRPCError

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

type JRPCRequest

type JRPCRequest struct {
	ID      string          `json:"id"`
	JSONRPC string          `json:"jsonrpc"`
	Method  string          `json:"method"`
	Params  json.RawMessage `json:"params"`
}

type JRPCResponse

type JRPCResponse struct {
	ID      string          `json:"id,omitempty"`
	JSONRPC string          `json:"jsonrpc,omitempty"`
	Result  json.RawMessage `json:"result,omitempty"`
	Error   *JRPCError      `json:"error,omitempty"`
}

type MethodPrefix

type MethodPrefix string
const (
	MethodInvalid MethodPrefix = ""
	MethodIdx     MethodPrefix = "idx_"
	MethodAuth    MethodPrefix = "auth_"
)

type RateLimitStrategy

type RateLimitStrategy string
const (
	RateLimitStrategyIP   RateLimitStrategy = "ip"
	RateLimitStrategyKey  RateLimitStrategy = "key"
	RateLimitStrategyNone RateLimitStrategy = "none"
)

func ToRateLimitStrategy

func ToRateLimitStrategy(s string) RateLimitStrategy

type Response

type Response interface{}

type Server

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

func NewServer

func NewServer(conf config.Config, stores *storage.StoreMap) *Server

NewServer returns a new server given a Store interface.

func (*Server) Listen

func (s *Server) Listen(addr string) error

Listen starts listening on the given address.

Jump to

Keyboard shortcuts

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