rpc: new RPC implementation with pub/sub support

This commit is contained in:
Bas van Kervel
2015-10-15 16:07:19 +02:00
parent 8db9d44ca9
commit eae81465c1
38 changed files with 4651 additions and 14 deletions

View File

@@ -28,6 +28,8 @@ import (
"github.com/ethereum/go-ethereum/logger"
"github.com/ethereum/go-ethereum/logger/glog"
"github.com/ethereum/go-ethereum/p2p"
rpc "github.com/ethereum/go-ethereum/rpc/v2"
"gopkg.in/fatih/set.v0"
)
@@ -98,6 +100,18 @@ func New() *Whisper {
return whisper
}
// APIs returns the RPC descriptors the Whisper implementation offers
func (s *Whisper) APIs() []rpc.API {
return []rpc.API{
{
Namespace: "shh",
Version: "1.0",
Service: NewPublicWhisperAPI(s),
Public: true,
},
}
}
// Protocols returns the whisper sub-protocols ran by this particular client.
func (self *Whisper) Protocols() []p2p.Protocol {
return []p2p.Protocol{self.protocol}