Documentation ¶
Index ¶
- Constants
- Variables
- func DefaultIPCEndpoint(clientIdentifier string) string
- func StartHTTPEndpoint(endpoint string, apis []app.API, modules []string, cors []string, ...) (net.Listener, *rpc.Server, error)
- func StartIPCEndpoint(ipcEndpoint string, apis []app.API) (net.Listener, *rpc.Server, error)
- func StartWSEndpoint(endpoint string, apis []app.API, modules []string, wsOrigins []string, ...) (net.Listener, *rpc.Server, error)
- type HTTPControl
- type IPCControl
- type InProcControl
- type RESTControl
- type Rpc
- type RpcService
- func (rpcService *RpcService) Api() []app.API
- func (rpcService *RpcService) CommandFlags() ([]cli.Command, []cli.Flag)
- func (rpcService *RpcService) DefaultConfig() *rpc.RpcConfig
- func (rpcService *RpcService) Init(executeContext *app.ExecuteContext) error
- func (rpcService *RpcService) Name() string
- func (rpcService *RpcService) P2pMessages() map[int]interface{}
- func (rpcService *RpcService) Receive(context actor.Context)
- func (rpcService *RpcService) Start(executeContext *app.ExecuteContext) error
- func (rpcService *RpcService) StartHTTP(endpoint string, apis []app.API, modules []string, cors []string, ...) error
- func (rpcService *RpcService) StartIPC(apis []app.API) error
- func (rpcService *RpcService) StartInProc(apis []app.API) error
- func (rpcService *RpcService) StartRest(endpoint string, restApi rpc.RestDescription) error
- func (rpcService *RpcService) StartWS(endpoint string, apis []app.API, modules []string, wsOrigins []string, ...) error
- func (rpcService *RpcService) Stop(executeContext *app.ExecuteContext) error
- func (rpcService *RpcService) StopHTTP()
- func (rpcService *RpcService) StopIPC()
- func (rpcService *RpcService) StopInProc()
- func (rpcService *RpcService) StopREST()
- func (rpcService *RpcService) StopWS()
- type WSControl
Constants ¶
const (
ClientIdentifier = "drep"
)
const (
MODULENAME = "rpc"
)
Variables ¶
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 ¶
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 ¶
StartIPCEndpoint starts an IPC endpoint.
Types ¶
type HTTPControl ¶
type IPCControl ¶
type InProcControl ¶
type RESTControl ¶
type RESTControl interface { StartRest(endpoint string, restApi rpc.RestDescription) error StopREST() }
type Rpc ¶
type Rpc interface { app.Service HTTPControl RESTControl InProcControl IPCControl WSControl }
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() *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.