comms

package
v1.3.4 Latest Latest
Warning

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

Go to latest
Published: Feb 29, 2016 License: GPL-3.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// List with all API's which are offered over the in proc interface by default
	DefaultInProcApis = shared.AllApis

	// List with all API's which are offered over the IPC interface by default
	DefaultIpcApis = shared.AllApis

	// List with API's which are offered over thr HTTP/RPC interface by default
	DefaultHttpRpcApis = strings.Join([]string{
		shared.DbApiName, shared.EthApiName, shared.NetApiName, shared.Web3ApiName,
	}, ",")
)

Functions

func NewHttpClient

func NewHttpClient(cfg HttpConfig, c codec.Codec) *httpClient

Create a new in process client

func NewIpcClient

func NewIpcClient(cfg IpcConfig, codec codec.Codec) (*ipcClient, error)

Create a new IPC client, UNIX domain socket on posix, named pipe on Windows

func StartHttp

func StartHttp(cfg HttpConfig, codec codec.Codec, api shared.EthereumApi) error

StartHTTP starts listening for RPC requests sent via HTTP.

func StartIpc

func StartIpc(cfg IpcConfig, codec codec.Codec, initializer InitFunc) error

Start IPC server

func StopHttp

func StopHttp()

Stop closes all active HTTP connections and shuts down the server.

Types

type EthereumClient

type EthereumClient interface {
	// Close underlying connection
	Close()
	// Send request
	Send(interface{}) error
	// Receive response
	Recv() (interface{}, error)
	// List with modules this client supports
	SupportedModules() (map[string]string, error)
}

func ClientFromEndpoint

func ClientFromEndpoint(endpoint string, c codec.Codec) (EthereumClient, error)

Endpoint must be in the form of: ${protocol}:${path} e.g. ipc:/tmp/geth.ipc

rpc:localhost:8545

type HttpConfig

type HttpConfig struct {
	ListenAddress string
	ListenPort    uint
	CorsDomain    string
}

type InProcClient

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

func NewInProcClient

func NewInProcClient(codec codec.Codec) *InProcClient

Create a new in process client

func (*InProcClient) Close

func (self *InProcClient) Close()

func (*InProcClient) Initialize

func (self *InProcClient) Initialize(offeredApi shared.EthereumApi)

Need to setup api support

func (*InProcClient) Recv

func (self *InProcClient) Recv() (interface{}, error)

func (*InProcClient) Send

func (self *InProcClient) Send(req interface{}) error

func (*InProcClient) SupportedModules

func (self *InProcClient) SupportedModules() (map[string]string, error)

type InitFunc added in v1.3.1

type InitFunc func(conn net.Conn) (Stopper, shared.EthereumApi, error)

type IpcConfig

type IpcConfig struct {
	Endpoint string
}

type Stopper added in v1.3.1

type Stopper interface {
	Stop()
}

Jump to

Keyboard shortcuts

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