all: remove public field from rpc.API (#25059)
all: remove public field from rpc.API
This commit is contained in:
@@ -37,7 +37,6 @@ func (n *Node) apis() []rpc.API {
|
||||
Namespace: "admin",
|
||||
Version: "1.0",
|
||||
Service: &adminAPI{n},
|
||||
Public: true,
|
||||
}, {
|
||||
Namespace: "debug",
|
||||
Version: "1.0",
|
||||
@@ -46,7 +45,6 @@ func (n *Node) apis() []rpc.API {
|
||||
Namespace: "web3",
|
||||
Version: "1.0",
|
||||
Service: &web3API{n},
|
||||
Public: true,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
+4
-4
@@ -281,7 +281,7 @@ func (h *httpServer) enableRPC(apis []rpc.API, config httpConfig) error {
|
||||
|
||||
// Create RPC server and handler.
|
||||
srv := rpc.NewServer()
|
||||
if err := RegisterApis(apis, config.Modules, srv, false); err != nil {
|
||||
if err := RegisterApis(apis, config.Modules, srv); err != nil {
|
||||
return err
|
||||
}
|
||||
h.httpConfig = config
|
||||
@@ -312,7 +312,7 @@ func (h *httpServer) enableWS(apis []rpc.API, config wsConfig) error {
|
||||
}
|
||||
// Create RPC server and handler.
|
||||
srv := rpc.NewServer()
|
||||
if err := RegisterApis(apis, config.Modules, srv, false); err != nil {
|
||||
if err := RegisterApis(apis, config.Modules, srv); err != nil {
|
||||
return err
|
||||
}
|
||||
h.wsConfig = config
|
||||
@@ -528,7 +528,7 @@ func (is *ipcServer) stop() error {
|
||||
|
||||
// RegisterApis checks the given modules' availability, generates an allowlist based on the allowed modules,
|
||||
// and then registers all of the APIs exposed by the services.
|
||||
func RegisterApis(apis []rpc.API, modules []string, srv *rpc.Server, exposeAll bool) error {
|
||||
func RegisterApis(apis []rpc.API, modules []string, srv *rpc.Server) error {
|
||||
if bad, available := checkModuleAvailability(modules, apis); len(bad) > 0 {
|
||||
log.Error("Unavailable modules in HTTP API list", "unavailable", bad, "available", available)
|
||||
}
|
||||
@@ -539,7 +539,7 @@ func RegisterApis(apis []rpc.API, modules []string, srv *rpc.Server, exposeAll b
|
||||
}
|
||||
// Register all the APIs exposed by the services
|
||||
for _, api := range apis {
|
||||
if exposeAll || allowList[api.Namespace] || (len(allowList) == 0 && api.Public) {
|
||||
if allowList[api.Namespace] || len(allowList) == 0 {
|
||||
if err := srv.RegisterName(api.Namespace, api.Service); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -100,12 +100,10 @@ func (f *FullService) APIs() []rpc.API {
|
||||
{
|
||||
Namespace: "debug",
|
||||
Version: "1.0",
|
||||
Public: true,
|
||||
},
|
||||
{
|
||||
Namespace: "net",
|
||||
Version: "1.0",
|
||||
Public: true,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user