rpc

package
v0.0.0-...-6fdbc3c Latest Latest
Warning

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

Go to latest
Published: May 23, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrResponse is thrown on a connection time out
	ErrResponse = errors.New("no response from server")
)
View Source
var (
	// Services is a list of exported services
	// registered by the RPC server at runtime
	Services = []interface{}{
		Ping{},
	}
)

Functions

This section is empty.

Types

type Client

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

Client wraps an RPC client

func (*Client) Close

func (c *Client) Close() error

Close an RPC connection

func (*Client) Init

func (c *Client) Init(addr string) (err error)

Init an RPC connection

func (*Client) Ping

func (c *Client) Ping(ctx context.Context) (ack bool, err error)

Ping an RPC server

type Ping

type Ping struct{}

Ping is a basic RPC service for checking the health of a node

func (Ping) Ping

func (p Ping) Ping(data []byte, ack *bool) error

Ping an rpc server

type Server

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

Server wraps a JSON RPC server

func (*Server) Close

func (s *Server) Close() error

Close an RPC connection

func (*Server) Init

func (s *Server) Init(host string, port uint16) (err error)

Init an RPC server

func (*Server) Run

func (s *Server) Run(ctx context.Context) error

Run the server's main loop

Jump to

Keyboard shortcuts

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