proxy

package
v0.13.5 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2020 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const MethodAccountBalance = "account_balance"
View Source
const MethodAccountList = "account_list"
View Source
const MethodClaimSearch = "claim_search"
View Source
const MethodFileList = "file_list"
View Source
const MethodGet = "get"
View Source
const MethodResolve = "resolve"
View Source
const MethodStatus = "status"

Variables

This section is empty.

Functions

func EnsureAuthenticated added in v0.13.3

func EnsureAuthenticated(ar auth.Result, w http.ResponseWriter) bool

func Handle added in v0.13.3

func Handle(w http.ResponseWriter, r *http.Request)

Handle forwards client JSON-RPC request to proxy.

func HandleCORS added in v0.13.3

func HandleCORS(w http.ResponseWriter, r *http.Request)

HandleCORS returns necessary CORS headers for pre-flight requests to proxy API

func MethodNeedsAuth added in v0.13.3

func MethodNeedsAuth(method string) bool

Types

type Caller added in v0.7.0

type Caller struct {
	// Preprocessor is applied to query before it's sent to the SDK.
	Preprocessor func(q *Query)
	// contains filtered or unexported fields
}

Caller patches through JSON-RPC requests from clients, doing pre/post-processing, account processing and validation.

func NewCaller added in v0.13.3

func NewCaller(endpoint string, userID int) *Caller

func (*Caller) Call added in v0.7.0

func (c *Caller) Call(req *jsonrpc.RPCRequest) []byte

Call method processes a raw query received from JSON-RPC client and forwards it to LbrynetServer. It returns a response that is ready to be sent back to the JSON-RPC client as is.

func (*Caller) CallRaw added in v0.13.3

func (c *Caller) CallRaw(rawQuery []byte) []byte

type Query added in v0.7.0

type Query struct {
	Request  *jsonrpc.RPCRequest
	WalletID string
}

Query is a wrapper around client JSON-RPC query for easier (un)marshaling and processing.

func NewQuery added in v0.7.0

func NewQuery(req *jsonrpc.RPCRequest) (*Query, error)

NewQuery initializes Query object with JSON-RPC request supplied as bytes. The object is immediately usable and returns an error in case request parsing fails.

func (*Query) Method added in v0.7.0

func (q *Query) Method() string

Method is a shortcut for query method.

func (*Query) Params added in v0.7.0

func (q *Query) Params() interface{}

Params is a shortcut for query params.

func (*Query) ParamsAsMap added in v0.7.0

func (q *Query) ParamsAsMap() map[string]interface{}

ParamsAsMap returns query params converted to plain map.

type RPCError added in v0.13.3

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

func NewAuthRequiredError added in v0.13.3

func NewAuthRequiredError(e error) RPCError

func NewForbiddenError added in v0.13.3

func NewForbiddenError(e error) RPCError

func NewInternalError added in v0.7.0

func NewInternalError(e error) RPCError

func NewInvalidParamsError added in v0.13.3

func NewInvalidParamsError(e error) RPCError

func NewJSONParseError added in v0.13.3

func NewJSONParseError(e error) RPCError

func NewMethodNotAllowedError added in v0.13.3

func NewMethodNotAllowedError(e error) RPCError

func NewSDKError added in v0.13.3

func NewSDKError(e error) RPCError

func (RPCError) Code added in v0.13.3

func (e RPCError) Code() int

func (RPCError) Error added in v0.13.3

func (e RPCError) Error() string

func (RPCError) JSON added in v0.13.3

func (e RPCError) JSON() []byte

func (RPCError) Unwrap added in v0.13.3

func (e RPCError) Unwrap() error

Jump to

Keyboard shortcuts

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