rpc

package
v0.0.0-...-a173fca Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2021 License: LGPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ClientIdentifier = "drep"
)
View Source
const (
	MODULENAME = "rpc"
)

Variables

View Source
var (
	// RPC settings
	HTTPEnabledFlag = cli.BoolFlag{
		Name:  "http",
		Usage: "StartMiner the HTTP-RPC server",
	}
	HTTPListenAddrFlag = cli.StringFlag{
		Name:  "httpaddr",
		Usage: "HTTP-RPC server listening interface",
		Value: rpc.DefaultHTTPHost,
	}
	HTTPPortFlag = cli.IntFlag{
		Name:  "httpport",
		Usage: "HTTP-RPC server listening port",
		Value: rpc.DefaultHTTPPort,
	}
	HTTPCORSDomainFlag = cli.StringFlag{
		Name:  "httpcorsdomain",
		Usage: "Comma separated list of domains from which to accept cross origin requests (browser enforced)",
		Value: "",
	}
	HTTPVirtualHostsFlag = cli.StringFlag{
		Name:  "httpvhosts",
		Usage: "Comma separated list of virtual hostnames from which to accept requests (server enforced). Accepts '*' wildcard.",
		Value: strings.Join([]string{"localhost"}, ","),
	}
	HTTPApiFlag = cli.StringFlag{
		Name:  "httpapi",
		Usage: "API's offered over the HTTP-RPC interface",
		Value: "",
	}
	IPCDisabledFlag = cli.BoolFlag{
		Name:  "ipcdisable",
		Usage: "Disable the IPC-RPC server",
	}
	IPCPathFlag = common.DirectoryFlag{
		Name:  "ipcpath",
		Usage: "Filename for IPC socket/pipe within the datadir (explicit paths escape it)",
	}
	WSEnabledFlag = cli.BoolFlag{
		Name:  "ws",
		Usage: "StartMiner the WS-RPC server",
	}
	WSListenAddrFlag = cli.StringFlag{
		Name:  "wsaddr",
		Usage: "WS-RPC server listening interface",
		Value: rpc.DefaultWSHost,
	}
	WSPortFlag = cli.IntFlag{
		Name:  "wsport",
		Usage: "WS-RPC server listening port",
		Value: rpc.DefaultWSPort,
	}
	WSApiFlag = cli.StringFlag{
		Name:  "wsapi",
		Usage: "API's offered over the WS-RPC interface",
		Value: "",
	}
	WSAllowedOriginsFlag = cli.StringFlag{
		Name:  "wsorigins",
		Usage: "Origins from which to accept websockets requests",
		Value: "",
	}
	// RPC settings
	RESTEnabledFlag = cli.BoolFlag{
		Name:  "rest",
		Usage: "StartMiner the REST-RPC server",
	}
	RESTListenAddrFlag = cli.StringFlag{
		Name:  "restaddr",
		Usage: "REST-RPC server listening interface",
		Value: rpc.DefaultRestHost,
	}
	RESTPortFlag = cli.IntFlag{
		Name:  "restport",
		Usage: "REST-RPC server listening port",
		Value: rpc.DefaultRestPort,
	}
)

Functions

func DefaultIPCEndpoint

func DefaultIPCEndpoint(clientIdentifier string) string

DefaultIPCEndpoint returns the IPC path used by default.

func StartHTTPEndpoint

func StartHTTPEndpoint(endpoint string, apis []app.API, modules []string, cors []string, vhosts []string, timeouts rpc.HTTPTimeouts) (net.Listener, *rpc.Server, error)

StartHTTPEndpoint starts the HTTP RPC endpoint, configured with cors/vhosts/modules

func StartIPCEndpoint

func StartIPCEndpoint(ipcEndpoint string, apis []app.API) (net.Listener, *rpc.Server, error)

StartIPCEndpoint starts an IPC endpoint.

func StartWSEndpoint

func StartWSEndpoint(endpoint string, apis []app.API, modules []string, wsOrigins []string, exposeAll bool) (net.Listener, *rpc.Server, error)

StartWSEndpoint starts a websocket endpoint

Types

type HTTPControl

type HTTPControl interface {
	StartHTTP(endpoint string, apis []app.API, modules []string, cors []string, vhosts []string, timeouts *rpc.HTTPTimeouts)
	StopHTTP()
}

type IPCControl

type IPCControl interface {
	StartIPC(apis []app.API)
	StopIPC()
}

type InProcControl

type InProcControl interface {
	StartInProc(apis []app.API) error
	StopInProc()
}

type RESTControl

type RESTControl interface {
	StartRest(endpoint string, restApi rpc.RestDescription) error
	StopREST()
}

type RpcService

type RpcService struct {
	RpcAPIs []app.API // List of APIs currently provided by the node
	RestApi rpc.RestDescription

	IpcEndpoint string       // IPC endpoint to listen at (empty = IPC disabled)
	IpcListener net.Listener // IPC RPC listener socket to serve API requests
	IpcHandler  *rpc.Server  // IPC RPC request handler to process the API requests

	HttpEndpoint  string       // HTTP endpoint (interface + port) to listen at (empty = HTTP disabled)
	HttpWhitelist []string     // HTTP RPC modules to allow through this endpoint
	HttpListener  net.Listener // HTTP RPC listener socket to server API requests
	HttpHandler   *rpc.Server  // HTTP RPC request handler to process the API requests

	WsEndpoint string       // Websocket endpoint (interface + port) to listen at (empty = websocket disabled)
	WsListener net.Listener // Websocket RPC listener socket to server API requests
	WsHandler  *rpc.Server  // Websocket RPC request handler to process the API requests

	RestEndpoint   string              // Websocket endpoint (interface + port) to listen at (empty = websocket disabled)
	RestController *rpc.RestController // Websocket RPC listener socket to server API requests

	Config *rpc.RpcConfig
	// contains filtered or unexported fields
}

func (*RpcService) Api

func (rpcService *RpcService) Api() []app.API

func (*RpcService) CommandFlags

func (rpcService *RpcService) CommandFlags() ([]cli.Command, []cli.Flag)

func (*RpcService) DefaultConfig

func (rpcService *RpcService) DefaultConfig(netType params.NetType) *rpc.RpcConfig

func (*RpcService) Init

func (rpcService *RpcService) Init(executeContext *app.ExecuteContext) error

func (*RpcService) Name

func (rpcService *RpcService) Name() string

func (*RpcService) P2pMessages

func (rpcService *RpcService) P2pMessages() map[int]interface{}

func (*RpcService) Receive

func (rpcService *RpcService) Receive(context actor.Context)

func (*RpcService) Start

func (rpcService *RpcService) Start(executeContext *app.ExecuteContext) error

func (*RpcService) StartHTTP

func (rpcService *RpcService) StartHTTP(endpoint string, apis []app.API, modules []string, cors []string, vhosts []string, timeouts *rpc.HTTPTimeouts) error

StartHTTP initializes and starts the HTTP RPC endpoint.

func (*RpcService) StartIPC

func (rpcService *RpcService) StartIPC(apis []app.API) error

StartIPC initializes and starts the IPC RPC endpoint.

func (*RpcService) StartInProc

func (rpcService *RpcService) StartInProc(apis []app.API) error

StartInProc initializes an in-process RPC endpoint.

func (*RpcService) StartRest

func (rpcService *RpcService) StartRest(endpoint string, restApi rpc.RestDescription) error

TODO split big rpc to small controller (HTTP WS IPC REST StartHTTP initializes and starts the HTTP RPC endpoint.

func (*RpcService) StartWS

func (rpcService *RpcService) StartWS(endpoint string, apis []app.API, modules []string, wsOrigins []string, exposeAll bool) error

StartWS initializes and starts the websocket RPC endpoint.

func (*RpcService) Stop

func (rpcService *RpcService) Stop(executeContext *app.ExecuteContext) error

func (*RpcService) StopHTTP

func (rpcService *RpcService) StopHTTP()

StopHTTP terminates the HTTP RPC endpoint.

func (*RpcService) StopIPC

func (rpcService *RpcService) StopIPC()

StopIPC terminates the IPC RPC endpoint.

func (*RpcService) StopInProc

func (rpcService *RpcService) StopInProc()

StopInProc terminates the in-process RPC endpoint.

func (*RpcService) StopREST

func (rpcService *RpcService) StopREST()

StopHTTP terminates the HTTP RPC endpoint.

func (*RpcService) StopWS

func (rpcService *RpcService) StopWS()

StopWS terminates the websocket RPC endpoint.

type WSControl

type WSControl interface {
	StartWS(endpoint string, apis []app.API, modules []string, wsOrigins []string, exposeAll bool) error
	StopWS()
}

Jump to

Keyboard shortcuts

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