rpc

package
v0.0.0-...-ddd0786 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2016 License: ISC Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrIdentityNotFound is returned by GetIdentity.
	ErrIdentityNotFound = errors.New("identity not found")
)

Functions

func DisableLog

func DisableLog()

DisableLog disables all library log output. Logging output is disabled by default until either UseLogger or SetLogWriter are called.

func UseClientLogger

func UseClientLogger(logger btclog.Logger)

UseClientLogger uses a specified Logger to output client logging info. This should be used in preference to SetLogWriter if the caller is also using btclog.

func UseServerLogger

func UseServerLogger(logger btclog.Logger)

UseServerLogger uses a specified Logger to output client logging info. This should be used in preference to SetLogWriter if the caller is also using btclog.

Types

type Client

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

Client encapsulates a connection to bmd and provides helper methods for retrieving relevant data.

func NewClient

func NewClient(cfg *ClientConfig, msg, broadcast, getpubkey func(counter uint64, msg []byte)) (*Client, error)

NewClient creates a new RPC connection to bmd.

func (*Client) GetIdentity

func (c *Client) GetIdentity(address string) (*identity.Public, error)

GetIdentity returns the public identity corresponding to the given address if it exists.

func (*Client) SendObject

func (c *Client) SendObject(obj []byte) (uint64, error)

SendObject sends the given object to bmd so that it can send it out to the network.

func (*Client) Start

func (c *Client) Start(msgCounter, broadcastCounter, getpubkeyCounter uint64)

Start starts the RPC client connection with bmd.

func (*Client) Stop

func (c *Client) Stop()

Stop disconnects the client and signals the shutdown of all goroutines started by Start.

func (*Client) WaitForShutdown

func (c *Client) WaitForShutdown()

WaitForShutdown blocks until both the client has finished disconnecting and all handlers have exited.

type ClientConfig

type ClientConfig struct {
	// DisableTLS specifies whether TLS should be disabled for a connection to
	// bmd.
	DisableTLS bool

	// CAFile is  the file containing root certificates to authenticate a TLS
	// connection with bmd.
	CAFile string

	// ConnectTo is the hostname/IP and port of bmd RPC server to connect to.
	ConnectTo string

	// Username is the username to use for authentication with bmd.
	Username string

	// Password is the password to use for authentication with bmd.
	Password string

	// The timeout duration.
	Timeout time.Duration
}

ClientConfig are configuration options for the RPC client to bmd.

Jump to

Keyboard shortcuts

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