service

package
v0.0.0-...-7505a0c Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2019 License: LGPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ClientIdentifier = "drep"
)

Variables

View Source
var (
	// RPC settings
	HTTPEnabledFlag = cli.BoolFlag{
		Name:  "http",
		Usage: "Enable the HTTP-RPC server",
	}
	HTTPListenAddrFlag = cli.StringFlag{
		Name:  "httpaddr",
		Usage: "HTTP-RPC server listening interface",
		Value: rpcTypes.DefaultHTTPHost,
	}
	HTTPPortFlag = cli.IntFlag{
		Name:  "httpport",
		Usage: "HTTP-RPC server listening port",
		Value: rpcTypes.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: "Enable the WS-RPC server",
	}
	WSListenAddrFlag = cli.StringFlag{
		Name:  "wsaddr",
		Usage: "WS-RPC server listening interface",
		Value: rpcTypes.DefaultWSHost,
	}
	WSPortFlag = cli.IntFlag{
		Name:  "wsport",
		Usage: "WS-RPC server listening port",
		Value: rpcTypes.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: "Enable the REST-RPC server",
	}
	RESTListenAddrFlag = cli.StringFlag{
		Name:  "restaddr",
		Usage: "REST-RPC server listening interface",
		Value: rpcTypes.DefaultRestHost,
	}
	RESTPortFlag = cli.IntFlag{
		Name:  "restport",
		Usage: "REST-RPC server listening port",
		Value: rpcTypes.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 rpcTypes.HTTPTimeouts) (net.Listener, *rpcTypes.Server, error)

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

func StartIPCEndpoint

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

StartIPCEndpoint starts an IPC endpoint.

func StartWSEndpoint

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

StartWSEndpoint starts a websocket endpoint

Types

type RpcService

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

	IpcEndpoint string           // IPC endpoint to listen at (empty = IPC disabled)
	IpcListener net.Listener     // IPC RPC listener socket to serve API requests
	IpcHandler  *rpcTypes.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   *rpcTypes.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  *rpcTypes.Server // Websocket RPC request handler to process the API requests

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

	RpcConfig *rpcTypes.RpcConfig
	// contains filtered or unexported fields
}

func (*RpcService) Api

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

func (*RpcService) Flags

func (rpcService *RpcService) Flags() []cli.Flag

func (*RpcService) Init

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

func (*RpcService) Name

func (rpcService *RpcService) Name() string

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 rpcTypes.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 rpcTypes.RestDescription) error

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.

Jump to

Keyboard shortcuts

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