Official Go implementation of the Ethereum protocol
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
go-ethereum/rpc/comms/ipc.go

37 lines
815 B

package comms
import (
"github.com/ethereum/go-ethereum/rpc/api"
"github.com/ethereum/go-ethereum/rpc/codec"
)
type IpcConfig struct {
Endpoint string
}
type ipcClient struct {
codec codec.ApiCoder
}
func (self *ipcClient) Close() {
self.codec.Close()
}
func (self *ipcClient) Send(req interface{}) error {
return self.codec.WriteResponse(req)
}
func (self *ipcClient) Recv() (interface{}, error) {
return self.codec.ReadResponse()
}
// Create a new IPC client, UNIX domain socket on posix, named pipe on Windows
func NewIpcClient(cfg IpcConfig, codec codec.Codec) (*ipcClient, error) {
return newIpcClient(cfg, codec)
}
// Start IPC server
func StartIpc(cfg IpcConfig, codec codec.Codec, apis ...api.EthereumApi) error {
offeredApi := api.Merge(apis...)
return startIpc(cfg, codec, offeredApi)
}