aboutsummaryrefslogtreecommitdiffstats
path: root/rpc/comms/ipc.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2015-06-16 01:28:48 +0800
committerobscuren <geffobscura@gmail.com>2015-06-16 01:28:48 +0800
commit5daf8729be88eca87b302ebf7a46fc69cad0f6d0 (patch)
tree0053cb5b84978645b3c83895a651c512e081a183 /rpc/comms/ipc.go
parentbac9a94ddf20dc530966cbf6cd384aaf94aedc77 (diff)
parent4673b04503742de9b1622557b44135d6a4934ad6 (diff)
downloadgo-tangerine-0.9.30.tar
go-tangerine-0.9.30.tar.gz
go-tangerine-0.9.30.tar.bz2
go-tangerine-0.9.30.tar.lz
go-tangerine-0.9.30.tar.xz
go-tangerine-0.9.30.tar.zst
go-tangerine-0.9.30.zip
Merge branch 'release/0.9.30'v0.9.30
Diffstat (limited to 'rpc/comms/ipc.go')
-rw-r--r--rpc/comms/ipc.go37
1 files changed, 37 insertions, 0 deletions
diff --git a/rpc/comms/ipc.go b/rpc/comms/ipc.go
new file mode 100644
index 000000000..a75039d17
--- /dev/null
+++ b/rpc/comms/ipc.go
@@ -0,0 +1,37 @@
+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 {
+ c codec.ApiCoder
+}
+
+func (self *ipcClient) Close() {
+ self.c.Close()
+}
+
+func (self *ipcClient) Send(req interface{}) error {
+ return self.c.WriteResponse(req)
+}
+
+func (self *ipcClient) Recv() (interface{}, error) {
+ return self.c.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)
+}