rpc

package
v1.0.1-rc.4 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2023 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ListenAddrFlagName = "rpc.addr"
	PortFlagName       = "rpc.port"
)

Variables

This section is empty.

Functions

func CLIFlags

func CLIFlags(envPrefix string) []cli.Flag

Types

type CLIConfig

type CLIConfig struct {
	ListenAddr string
	ListenPort int
}

func ReadCLIConfig

func ReadCLIConfig(ctx *cli.Context) CLIConfig

func (CLIConfig) Check

func (c CLIConfig) Check() 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 kmetrics.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