Skip to content
Snippets Groups Projects
Commit 23ed9e39 authored by Josh Brooks's avatar Josh Brooks
Browse files

Respond to MR comments

parent 0ba8accb
No related branches found
No related tags found
2 merge requests!510Release,!297Add GetNDF for gateways to the API
...@@ -101,12 +101,11 @@ var getNDFCmd = &cobra.Command{ ...@@ -101,12 +101,11 @@ var getNDFCmd = &cobra.Command{
// Gateway lookup // Gateway lookup
if gwHost != "" { if gwHost != "" {
resp, err := xxdk.DownloadNdfFromGateway(gwHost, cert) ndfJSon, err := xxdk.DownloadNdfFromGateway(gwHost, cert)
fmt.Printf("%s", resp.PartialNDF.Ndf)
if err != nil { if err != nil {
jww.FATAL.Panicf("%v", err) jww.FATAL.Panicf("%v", err)
} }
fmt.Printf("%s", resp.PartialNDF.Ndf) fmt.Printf("%s", ndfJSon)
return return
} }
......
...@@ -26,10 +26,9 @@ import ( ...@@ -26,10 +26,9 @@ import (
// DownloadNdfFromGateway will download an NDF from a gateway on the cMix network. // DownloadNdfFromGateway will download an NDF from a gateway on the cMix network.
// It will take the given address and certificate and send a request to a gateway // It will take the given address and certificate and send a request to a gateway
// for an NDF over HTTP/2 using the xx network's gRPC implementation. // for an NDF over HTTP/2 using the xx network's gRPC implementation.
// This returns a gRPC protobuf message which contains the NDF in the // This returns a JSON marshalled version of the NDF.
// PartialNDF field of the pb.GatewayPollResponse.
func DownloadNdfFromGateway(address string, cert []byte) ( func DownloadNdfFromGateway(address string, cert []byte) (
*pb.GatewayPollResponse, error) { []byte, error) {
// Establish parameters for gRPC // Establish parameters for gRPC
params := connect.GetDefaultHostParams() params := connect.GetDefaultHostParams()
params.AuthEnabled = false params.AuthEnabled = false
...@@ -60,7 +59,12 @@ func DownloadNdfFromGateway(address string, cert []byte) ( ...@@ -60,7 +59,12 @@ func DownloadNdfFromGateway(address string, cert []byte) (
} }
// Send poll request and receive response containing NDF // Send poll request and receive response containing NDF
return comms.SendPoll(host, pollMsg) resp, err := comms.SendPoll(host, pollMsg)
if err != nil {
return nil, err
}
return resp.PartialNDF.Ndf, nil
} }
// DownloadAndVerifySignedNdfWithUrl retrieves the NDF from a specified URL. // DownloadAndVerifySignedNdfWithUrl retrieves the NDF from a specified URL.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment