github.com/devwanda/aphelion-staking@v0.33.9/cmd/tendermint/commands/probe_upnp.go (about)

     1  package commands
     2  
     3  import (
     4  	"fmt"
     5  
     6  	"github.com/spf13/cobra"
     7  
     8  	"github.com/devwanda/aphelion-staking/p2p/upnp"
     9  )
    10  
    11  // ProbeUpnpCmd adds capabilities to test the UPnP functionality.
    12  var ProbeUpnpCmd = &cobra.Command{
    13  	Use:   "probe_upnp",
    14  	Short: "Test UPnP functionality",
    15  	RunE:  probeUpnp,
    16  }
    17  
    18  func probeUpnp(cmd *cobra.Command, args []string) error {
    19  	capabilities, err := upnp.Probe(logger)
    20  	if err != nil {
    21  		fmt.Println("Probe failed: ", err)
    22  	} else {
    23  		fmt.Println("Probe success!")
    24  		jsonBytes, err := cdc.MarshalJSON(capabilities)
    25  		if err != nil {
    26  			return err
    27  		}
    28  		fmt.Println(string(jsonBytes))
    29  	}
    30  	return nil
    31  }