github.com/celestiaorg/celestia-node@v0.15.0-beta.1/share/p2p/shrexnd/params.go (about)

     1  package shrexnd
     2  
     3  import (
     4  	"fmt"
     5  
     6  	logging "github.com/ipfs/go-log/v2"
     7  
     8  	"github.com/celestiaorg/celestia-node/share/p2p"
     9  )
    10  
    11  const protocolString = "/shrex/nd/v0.0.3"
    12  
    13  var log = logging.Logger("shrex/nd")
    14  
    15  // Parameters is the set of parameters that must be configured for the shrex/eds protocol.
    16  type Parameters = p2p.Parameters
    17  
    18  func DefaultParameters() *Parameters {
    19  	return p2p.DefaultParameters()
    20  }
    21  
    22  func (c *Client) WithMetrics() error {
    23  	metrics, err := p2p.InitClientMetrics("nd")
    24  	if err != nil {
    25  		return fmt.Errorf("shrex/nd: init Metrics: %w", err)
    26  	}
    27  	c.metrics = metrics
    28  	return nil
    29  }
    30  
    31  func (srv *Server) WithMetrics() error {
    32  	metrics, err := p2p.InitServerMetrics("nd")
    33  	if err != nil {
    34  		return fmt.Errorf("shrex/nd: init Metrics: %w", err)
    35  	}
    36  	srv.metrics = metrics
    37  	return nil
    38  }