namespace

package
v0.0.0-...-eae65ad Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewHTTPHandlerStack

func NewHTTPHandlerStack(srv http.Handler, cors []string, vhosts []string) http.Handler

NewHTTPHandlerStack returns wrapped http-related handlers

func NewVHostHandler

func NewVHostHandler(vhosts []string, next http.Handler) http.Handler

func RegisterApis

func RegisterApis(apis []rpc.API, modules []string, srv *rpc.Server, exposeAll bool) error

RegisterApis checks the given modules' availability, generates an allowlist based on the allowed modules, and then registers all of the APIs exposed by the services.

func StartHTTPEndpoint

func StartHTTPEndpoint(endpoint string, timeouts rpc.HTTPTimeouts, handler http.Handler) (*http.Server, net.Addr, error)

StartHTTPEndpoint starts the HTTP RPC endpoint.

Types

type HttpConfig

type HttpConfig struct {
	Modules            []string
	CorsAllowedOrigins []string
	Vhosts             []string
	// contains filtered or unexported fields
}

HttpConfig is the JSON-RPC/HTTP configuration.

type HttpServer

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

func NewHTTPServer

func NewHTTPServer(timeouts rpc.HTTPTimeouts) *HttpServer

func (*HttpServer) EnableRPC

func (h *HttpServer) EnableRPC(apis []rpc.API, config HttpConfig) error

EnableRPC turns on JSON-RPC over HTTP on the server.

func (*HttpServer) EnableTLS

func (h *HttpServer) EnableTLS(cert, key string)

func (*HttpServer) EnableWS

func (h *HttpServer) EnableWS(apis []rpc.API, config WsConfig, ctx context.Context) error

EnableWS turns on JSON-RPC over WebSocket on the server.

func (*HttpServer) ListenAddr

func (h *HttpServer) ListenAddr() string

ListenAddr returns the listening address of the server.

func (*HttpServer) ServeHTTP

func (h *HttpServer) ServeHTTP(w http.ResponseWriter, r *http.Request)

func (*HttpServer) SetListenAddr

func (h *HttpServer) SetListenAddr(host string, port int) error

SetListenAddr configures the listening address of the server. The address can only be set while the server isn't running.

func (*HttpServer) Start

func (h *HttpServer) Start(ctx context.Context) error

Start starts the HTTP server if it is enabled and not already running.

func (*HttpServer) Stop

func (h *HttpServer) Stop()

Stop shuts down the HTTP server.

type IpcServer

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

func NewIPCServer

func NewIPCServer(endpoint string) *IpcServer

func (*IpcServer) Start

func (is *IpcServer) Start(apis []rpc.API, ctx context.Context) error

Start starts the HttpServer's http.server

func (*IpcServer) Stop

func (is *IpcServer) Stop() error

type WsConfig

type WsConfig struct {
	Origins []string
	Modules []string
	Prefix  string // path Prefix on which to mount ws handler
}

WsConfig is the JSON-RPC/Websocket configuration

Jump to

Keyboard shortcuts

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