Documentation ¶
Index ¶
- Variables
- type BlockAppliedCallback
- type ErrorFunc
- type LatencyTester
- type NodeStats
- type RPCCall
- type RPCClient
- type ResponseError
- func (p ResponseError) Error() string
- func (j *ResponseError) MarshalJSON() ([]byte, error)
- func (j *ResponseError) MarshalJSONBuf(buf fflib.EncodingBuffer) error
- func (j *ResponseError) UnmarshalJSON(input []byte) error
- func (j *ResponseError) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error
- type ResponseErrorContext
- func (j *ResponseErrorContext) MarshalJSON() ([]byte, error)
- func (j *ResponseErrorContext) MarshalJSONBuf(buf fflib.EncodingBuffer) error
- func (j *ResponseErrorContext) UnmarshalJSON(input []byte) error
- func (j *ResponseErrorContext) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error
- type ResponseErrorData
- type ResponseErrorStack
- type SubscribeCallback
- type WebsocketClient
Constants ¶
This section is empty.
Variables ¶
var ( DialerTimeout = time.Duration(5 * time.Second) ReadWriteTimeout = time.Duration(10 * time.Second) ErrShutdown = errors.New("connection is shut down") )
var (
//LoopSeconds = time for one pass to calc dynamic delay
LoopSeconds = 60
)
Functions ¶
This section is empty.
Types ¶
type BlockAppliedCallback ¶ added in v0.6.1
type LatencyTester ¶
type LatencyTester interface { Start() Close() error String() string AddEndpoint(ep string) OnTopNodeChanged(fn func(string) error) TopNodeEndpoint() string TopNodeClient() WebsocketClient Done() <-chan struct{} }
LatencyTester provides reliability and speed testing through a collection of node endpoints and maintains the best connection.
func NewLatencyTester ¶
func NewLatencyTester(fallbackURL string) (LatencyTester, error)
NewLatencyTester creates a new LatencyTester and allows you to always be connected to the best node.
func NewLatencyTesterWithContext ¶
func NewLatencyTesterWithContext(ctx context.Context, fallbackURL string) (LatencyTester, error)
NewLatencyTesterWithContext - like NewLatencyTester but cancelable.
type NodeStats ¶
type NodeStats struct {
// contains filtered or unexported fields
}
NodeStats holds stat data for each endpoint
func NewNodeStats ¶
NewNodeStats creates a new stat object
type RPCCall ¶
type RPCCall struct { Method string Request rpcRequest Reply *json.RawMessage Error error Done chan *RPCCall }
ffjson: skip
type RPCClient ¶
type RPCClient interface { CallAPI(method string, args ...interface{}) (*json.RawMessage, error) Close() error Connect() error }
RPCClient allows you to access wallett functions
func NewRPCClient ¶
NewRPCClient creates a new RPC Client
type ResponseError ¶
type ResponseError struct { Code int `json:"code"` Message string `json:"message"` Data ResponseErrorData `json:"data"` }
func (ResponseError) Error ¶
func (p ResponseError) Error() string
func (*ResponseError) MarshalJSON ¶ added in v0.6.1
func (j *ResponseError) MarshalJSON() ([]byte, error)
MarshalJSON marshal bytes to json - template
func (*ResponseError) MarshalJSONBuf ¶ added in v0.6.1
func (j *ResponseError) MarshalJSONBuf(buf fflib.EncodingBuffer) error
MarshalJSONBuf marshal buff to json - template
func (*ResponseError) UnmarshalJSON ¶ added in v0.6.1
func (j *ResponseError) UnmarshalJSON(input []byte) error
UnmarshalJSON umarshall json - template of ffjson
func (*ResponseError) UnmarshalJSONFFLexer ¶ added in v0.6.1
func (j *ResponseError) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error
UnmarshalJSONFFLexer fast json unmarshall - template ffjson
type ResponseErrorContext ¶
type ResponseErrorContext struct { Level string `json:"level"` File string `json:"file"` Line int `json:"line"` Method string `json:"method"` Hostname string `json:"hostname"` ThreadName string `json:"thread_name"` Timestamp string `json:"timestamp"` }
func (*ResponseErrorContext) MarshalJSON ¶ added in v0.6.1
func (j *ResponseErrorContext) MarshalJSON() ([]byte, error)
MarshalJSON marshal bytes to json - template
func (*ResponseErrorContext) MarshalJSONBuf ¶ added in v0.6.1
func (j *ResponseErrorContext) MarshalJSONBuf(buf fflib.EncodingBuffer) error
MarshalJSONBuf marshal buff to json - template
func (*ResponseErrorContext) UnmarshalJSON ¶ added in v0.6.1
func (j *ResponseErrorContext) UnmarshalJSON(input []byte) error
UnmarshalJSON umarshall json - template of ffjson
func (*ResponseErrorContext) UnmarshalJSONFFLexer ¶ added in v0.6.1
func (j *ResponseErrorContext) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error
UnmarshalJSONFFLexer fast json unmarshall - template ffjson
type ResponseErrorData ¶
type ResponseErrorData struct { Code int `json:"code"` Name string `json:"name"` Message string `json:"message"` Stack []ResponseErrorStack `json:"stack"` }
func (*ResponseErrorData) MarshalJSON ¶ added in v0.6.1
func (j *ResponseErrorData) MarshalJSON() ([]byte, error)
MarshalJSON marshal bytes to json - template
func (*ResponseErrorData) MarshalJSONBuf ¶ added in v0.6.1
func (j *ResponseErrorData) MarshalJSONBuf(buf fflib.EncodingBuffer) error
MarshalJSONBuf marshal buff to json - template
func (*ResponseErrorData) UnmarshalJSON ¶ added in v0.6.1
func (j *ResponseErrorData) UnmarshalJSON(input []byte) error
UnmarshalJSON umarshall json - template of ffjson
func (*ResponseErrorData) UnmarshalJSONFFLexer ¶ added in v0.6.1
func (j *ResponseErrorData) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error
UnmarshalJSONFFLexer fast json unmarshall - template ffjson
type ResponseErrorStack ¶
type ResponseErrorStack struct { Context ResponseErrorContext `json:"context"` Format string `json:"format"` Data interface{} `json:"data"` }
func (*ResponseErrorStack) MarshalJSON ¶ added in v0.6.1
func (j *ResponseErrorStack) MarshalJSON() ([]byte, error)
MarshalJSON marshal bytes to json - template
func (*ResponseErrorStack) MarshalJSONBuf ¶ added in v0.6.1
func (j *ResponseErrorStack) MarshalJSONBuf(buf fflib.EncodingBuffer) error
MarshalJSONBuf marshal buff to json - template
func (*ResponseErrorStack) UnmarshalJSON ¶ added in v0.6.1
func (j *ResponseErrorStack) UnmarshalJSON(input []byte) error
UnmarshalJSON umarshall json - template of ffjson
func (*ResponseErrorStack) UnmarshalJSONFFLexer ¶ added in v0.6.1
func (j *ResponseErrorStack) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error
UnmarshalJSONFFLexer fast json unmarshall - template ffjson
type SubscribeCallback ¶ added in v0.6.1
type SubscribeCallback func(msg interface{}) error
type WebsocketClient ¶
type WebsocketClient interface { IsConnected() bool OnError(fn ErrorFunc) Subscribe(apiID int, method string, fn SubscribeCallback, args ...interface{}) (*json.RawMessage, error) Call(method string, args []interface{}) (*RPCCall, error) CallAPI(apiID int, method string, args ...interface{}) (*json.RawMessage, error) Close() error Connect() error }
func NewWebsocketClient ¶
func NewWebsocketClient(endpointURL string) WebsocketClient