rpc

package
v0.0.0-...-4e0ae02 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2016 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Overview

Package rpc implements Chain Core's RPC client.

Index

Constants

View Source
const (
	HeaderBlockchainID = "Blockchain-ID"
	HeaderCoreID       = "Chain-Core-ID"
	HeaderTimeout      = "RPC-Timeout"
)

Chain-specific header fields

Variables

View Source
var ErrWrongNetwork = errors.New("connected to a peer on a different network")

ErrWrongNetwork is returned when a peer's blockchain ID differs from the RPC client's blockchain ID.

Functions

This section is empty.

Types

type Client

type Client struct {
	BaseURL      string
	AccessToken  string
	Username     string
	BuildTag     string
	BlockchainID string
	CoreID       string
}

A Client is a Chain RPC client. It performs RPCs over HTTP using JSON request and responses. A Client must be configured with a secret token to authenticate with other Cores on the network.

func (*Client) Call

func (c *Client) Call(ctx context.Context, path string, request, response interface{}) error

Call calls a remote procedure on another node, specified by the path.

func (*Client) CallRaw

func (c *Client) CallRaw(ctx context.Context, path string, request interface{}) (io.ReadCloser, error)

CallRaw calls a remote procedure on another node, specified by the path. It returns a io.ReadCloser of the raw response body.

Jump to

Keyboard shortcuts

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