rpc

package
v1.4.2 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ListenAddrFlagName  = "rpc.addr"
	PortFlagName        = "rpc.port"
	EnableAdminFlagName = "rpc.enable-admin"
)

Variables

This section is empty.

Functions

func CLIFlags

func CLIFlags(envPrefix string) []cli.Flag

func ToGethAdminAPI added in v1.2.0

func ToGethAdminAPI(api *CommonAdminAPI) rpc.API

Types

type CLIConfig

type CLIConfig struct {
	ListenAddr  string
	ListenPort  int
	EnableAdmin bool
}

func DefaultCLIConfig added in v1.3.0

func DefaultCLIConfig() CLIConfig

func ReadCLIConfig

func ReadCLIConfig(ctx *cli.Context) CLIConfig

func (CLIConfig) Check

func (c CLIConfig) Check() error

type CommonAdminAPI

type CommonAdminAPI struct {
	M metrics.RPCMetricer
	// contains filtered or unexported fields
}

func NewCommonAdminAPI

func NewCommonAdminAPI(m metrics.RPCMetricer, log log.Logger) *CommonAdminAPI

func (*CommonAdminAPI) SetLogLevel

func (n *CommonAdminAPI) SetLogLevel(ctx context.Context, lvlStr string) error

type HealthzResponse

type HealthzResponse struct {
	Version string `json:"version"`
}

type Middleware

type Middleware func(next http.Handler) http.Handler

type Server

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

func NewServer

func NewServer(host string, port int, appVersion string, opts ...ServerOption) *Server

func (*Server) AddAPI

func (b *Server) AddAPI(api rpc.API)

func (*Server) Endpoint

func (b *Server) Endpoint() string

func (*Server) Start

func (b *Server) Start() error

func (*Server) Stop

func (b *Server) Stop() error

type ServerOption

type ServerOption func(b *Server)

func WithAPIs

func WithAPIs(apis []rpc.API) ServerOption

func WithCORSHosts

func WithCORSHosts(hosts []string) ServerOption

func WithHTTPRecorder

func WithHTTPRecorder(recorder opmetrics.HTTPRecorder) ServerOption

func WithHealthzHandler

func WithHealthzHandler(hdlr http.Handler) ServerOption

func WithHealthzPath

func WithHealthzPath(path string) ServerOption

func WithJWTSecret

func WithJWTSecret(secret []byte) ServerOption

func WithLogger

func WithLogger(lgr log.Logger) ServerOption

func WithMiddleware

func WithMiddleware(middleware func(http.Handler) (hdlr http.Handler)) ServerOption

WithMiddleware adds an http.Handler to the rpc server handler stack The added middleware is invoked directly before the RPC callback

func WithRPCPath

func WithRPCPath(path string) ServerOption

func WithTLSConfig

func WithTLSConfig(tls *ServerTLSConfig) ServerOption

WithTLSConfig configures TLS for the RPC server If this option is passed, the server will use ListenAndServeTLS

func WithVHosts

func WithVHosts(hosts []string) ServerOption

type ServerTLSConfig

type ServerTLSConfig struct {
	Config    *tls.Config
	CLIConfig *optls.CLIConfig // paths to certificate and key files
}

Jump to

Keyboard shortcuts

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