Documentation ¶
Index ¶
- func LocalRequestOnly(r *rpc.RequestInfo, i interface{}) error
- func LocalhostFilter() *ipfilter.IPFilter
- type BlockFinalizedListener
- type BlockListener
- type DotUpCodec
- type DotUpCodecRequest
- type ErrorMessageJSON
- type ErrorResponseJSON
- type HTTPServer
- type HTTPServerConfig
- type Listener
- type Service
- type StorageChangeListener
- type SubscriptionBaseResponseJSON
- type SubscriptionResponseJSON
- type WSConn
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LocalRequestOnly ¶ added in v0.3.0
func LocalRequestOnly(r *rpc.RequestInfo, i interface{}) error
LocalRequestOnly HTTP handler to restrict to only local connections
func LocalhostFilter ¶ added in v0.3.0
LocalhostFilter creates a ipfilter object for localhost
Types ¶
type BlockFinalizedListener ¶ added in v0.2.0
type BlockFinalizedListener struct {
// contains filtered or unexported fields
}
BlockFinalizedListener to handle listening for finalized blocks
func (*BlockFinalizedListener) Listen ¶ added in v0.2.0
func (l *BlockFinalizedListener) Listen()
Listen implementation of Listen interface to listen for channel changes
type BlockListener ¶ added in v0.2.0
type BlockListener struct {
// contains filtered or unexported fields
}
BlockListener to handle listening for blocks channel
func (*BlockListener) Listen ¶ added in v0.2.0
func (l *BlockListener) Listen()
Listen implementation of Listen interface to listen for channel changes
type DotUpCodec ¶
type DotUpCodec struct{}
DotUpCodec for overridding default jsonCodec
func NewDotUpCodec ¶
func NewDotUpCodec() *DotUpCodec
NewDotUpCodec for creating instance of DocUpCodec
func (*DotUpCodec) NewRequest ¶
func (c *DotUpCodec) NewRequest(r *http.Request) rpc.CodecRequest
NewRequest is overridden to inject our codec handler
type DotUpCodecRequest ¶
type DotUpCodecRequest struct {
*json2.CodecRequest
}
DotUpCodecRequest decodes and encodes a single request. UpCodecRequest implements gorilla/rpc.CodecRequest interface primarily by embedding the CodecRequest from gorilla/rpc/json. By selectively adding CodecRequest methods to UpCodecRequest, we can modify that behavior while maintaining all the other remaining CodecRequest methods from gorilla's rpc/json implementation
func (*DotUpCodecRequest) Method ¶
func (c *DotUpCodecRequest) Method() (string, error)
Method returns the decoded method as a string of the form "Service.Method" after checking for, and correcting a underscore and lowercase method name By being of lower depth in the struct , Method will replace the implementation of Method() on the embedded CodecRequest. Because the request data is part of the embedded json.CodecRequest, and unexported, we have to get the requested method name via the embedded CR's own method Method(). Essentially, this just intercepts the return value from the embedded gorilla/rpc/json.CodecRequest.Method(), checks/modifies it, and passes it on to the calling rpc server.
type ErrorMessageJSON ¶
ErrorMessageJSON json for error messages
type ErrorResponseJSON ¶
type ErrorResponseJSON struct { Jsonrpc string `json:"jsonrpc"` Error *ErrorMessageJSON `json:"error"` ID float64 `json:"id"` }
ErrorResponseJSON json for error responses
type HTTPServer ¶
type HTTPServer struct {
// contains filtered or unexported fields
}
HTTPServer gateway for RPC server
func NewHTTPServer ¶
func NewHTTPServer(cfg *HTTPServerConfig) *HTTPServer
NewHTTPServer creates a new http server and registers an associated rpc server
func (*HTTPServer) RegisterModules ¶
func (h *HTTPServer) RegisterModules(mods []string)
RegisterModules registers the RPC services associated with the given API modules
func (*HTTPServer) ServeHTTP ¶
func (h *HTTPServer) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP implemented to handle WebSocket connections
func (*HTTPServer) Start ¶
func (h *HTTPServer) Start() error
Start registers the rpc handler function and starts the rpc http and websocket server
type HTTPServerConfig ¶
type HTTPServerConfig struct { LogLvl log.Lvl BlockAPI modules.BlockAPI StorageAPI modules.StorageAPI NetworkAPI modules.NetworkAPI CoreAPI modules.CoreAPI BlockProducerAPI modules.BlockProducerAPI RuntimeAPI modules.RuntimeAPI TransactionQueueAPI modules.TransactionStateAPI RPCAPI modules.RPCAPI SystemAPI modules.SystemAPI External bool Host string RPCPort uint32 WS bool WSExternal bool WSPort uint32 Modules []string }
HTTPServerConfig configures the HTTPServer
type Listener ¶ added in v0.2.0
type Listener interface {
Listen()
}
Listener interface for functions that define Listener related functions
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service struct to hold rpc service data
func (*Service) BuildMethodNames ¶
BuildMethodNames takes receiver interface and populates rpcMethods array with available
method names
type StorageChangeListener ¶ added in v0.2.0
type StorageChangeListener struct {
// contains filtered or unexported fields
}
StorageChangeListener for listening to state change channels
func (*StorageChangeListener) Listen ¶ added in v0.2.0
func (l *StorageChangeListener) Listen()
Listen implementation of Listen interface to listen for channel changes
type SubscriptionBaseResponseJSON ¶
type SubscriptionBaseResponseJSON struct { Jsonrpc string `json:"jsonrpc"` Method string `json:"method"` Params interface{} `json:"params"` }
SubscriptionBaseResponseJSON for base json response
type SubscriptionResponseJSON ¶
type SubscriptionResponseJSON struct { Jsonrpc string `json:"jsonrpc"` Result int `json:"result"` ID float64 `json:"id"` }
SubscriptionResponseJSON for json subscription responses