core, eth, node, rpc: port the admin and debug API

This commit is contained in:
Péter Szilágyi
2015-12-04 20:56:11 +02:00
parent fa187a366d
commit d8370a4e15
7 changed files with 494 additions and 26 deletions

View File

@@ -266,9 +266,33 @@ func (n *Node) EventMux() *event.TypeMux {
return n.eventmux
}
// RPCAPIs returns the collection of RPC descriptor this node offers
func (n *Node) RPCAPIs() []rpc.API {
var apis []rpc.API
// APIs returns the collection of RPC descriptor this node offers. This method
// is just a quick placeholder passthrough for the RPC update, which in the next
// step will be fully integrated into the node itself.
func (n *Node) APIs() []rpc.API {
// Define all the APIs owned by the node itself
apis := []rpc.API{
{
Namespace: "admin",
Version: "1.0",
Service: NewPrivateAdminAPI(n),
}, {
Namespace: "admin",
Version: "1.0",
Service: NewPublicAdminAPI(n),
Public: true,
}, {
Namespace: "debug",
Version: "1.0",
Service: NewPrivateDebugAPI(n),
}, {
Namespace: "debug",
Version: "1.0",
Service: NewPublicDebugAPI(n),
Public: true,
},
}
// Inject all the APIs owned by various services
for _, api := range n.services {
apis = append(apis, api.APIs()...)
}