Skip to content

Commit

Permalink
fix admin api
Browse files Browse the repository at this point in the history
  • Loading branch information
hadv committed Aug 11, 2023
1 parent af231df commit f2ef6ee
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions node/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -307,18 +307,8 @@ func (api *adminAPI) NodeInfo() (*p2p.NodeInfo, error) {
return server.NodeInfo(), nil
}

// Datadir retrieves the current data directory the node is using.
func (api *adminAPI) Datadir() string {
return api.node.DataDir()
}

// publicWeb3API offers helper utils
type web3API struct {
stack *Node
}

func (s *web3API) PrivateNodes() ([]*p2p.NodeInfo, error) {
server := s.stack.Server()
func (api *adminAPI) PrivateNodes() ([]*p2p.NodeInfo, error) {
server := api.node.Server()
if server == nil {
return nil, ErrNodeStopped
}
Expand All @@ -333,14 +323,24 @@ func (s *web3API) PrivateNodes() ([]*p2p.NodeInfo, error) {
return infos, nil
}

func (s *web3API) Iprestrict() ([]string, error) {
server := s.stack.Server()
func (api *adminAPI) Iprestrict() ([]string, error) {
server := api.node.Server()
if server == nil {
return nil, ErrNodeStopped
}
return server.IPRestrict, nil
}

// Datadir retrieves the current data directory the node is using.
func (api *adminAPI) Datadir() string {
return api.node.DataDir()
}

// publicWeb3API offers helper utils
type web3API struct {
stack *Node
}

// ClientVersion returns the node name
func (s *web3API) ClientVersion() string {
return s.stack.Server().Name
Expand Down

0 comments on commit f2ef6ee

Please sign in to comment.