github.com/status-im/status-go@v1.1.0/services/rpcstats/service.go (about)

     1  package rpcstats
     2  
     3  import (
     4  	"github.com/ethereum/go-ethereum/p2p"
     5  	"github.com/ethereum/go-ethereum/rpc"
     6  )
     7  
     8  // Service represents our own implementation of status status operations.
     9  type Service struct{}
    10  
    11  // New returns a new Service.
    12  func New() *Service {
    13  	return &Service{}
    14  }
    15  
    16  // APIs returns a list of new APIs.
    17  func (s *Service) APIs() []rpc.API {
    18  	return []rpc.API{
    19  		{
    20  			Namespace: "rpcstats",
    21  			Version:   "1.0",
    22  			Service:   NewAPI(s),
    23  			Public:    true,
    24  		},
    25  	}
    26  }
    27  
    28  // Protocols returns list of p2p protocols.
    29  func (s *Service) Protocols() []p2p.Protocol {
    30  	return nil
    31  }
    32  
    33  // Start is run when a service is started.
    34  // It does nothing in this case but is required by `node.Service` interface.
    35  func (s *Service) Start() error {
    36  	resetStats()
    37  	return nil
    38  }
    39  
    40  // Stop is run when a service is stopped.
    41  // It does nothing in this case but is required by `node.Service` interface.
    42  func (s *Service) Stop() error {
    43  	return nil
    44  }