Skip to content
Snippets Groups Projects
Commit 2d5fc568 authored by Richard T. Carback III's avatar Richard T. Carback III
Browse files

add stub for permhost option

parent 3152ba00
No related branches found
No related tags found
No related merge requests found
......@@ -41,6 +41,7 @@ var getNDFCmd = &cobra.Command{
Args: cobra.NoArgs,
Run: func(cmd *cobra.Command, args []string) {
gwHost := viper.GetString("gwhost")
permHost := viper.GetString("permhost")
certPath := viper.GetString("cert")
// Load the certificate
......@@ -54,10 +55,14 @@ var getNDFCmd = &cobra.Command{
"You can download a cert using openssl:\n\n%s",
opensslCertDL)
}
// Gateway lookup
if gwHost != "" {
params := connect.GetDefaultHostParams()
params.AuthEnabled = false
comms, _ := client.NewClientComms(nil, nil, nil, nil)
host, _ := connect.NewHost(&id.TempGateway, gwHost, cert, params)
host, _ := connect.NewHost(&id.TempGateway, gwHost,
cert, params)
pollMsg := &pb.GatewayPoll{
Partial: &pb.NDFHash{
Hash: nil,
......@@ -67,12 +72,19 @@ var getNDFCmd = &cobra.Command{
}
resp, err := comms.SendPoll(host, pollMsg)
if err != nil {
jww.FATAL.Panicf("Unable to poll %s for NDF: %+v",
jww.FATAL.Panicf("Unable to poll %s for NDF:"+
" %+v",
gwHost, err)
}
fmt.Printf("%s", resp.PartialNDF.Ndf)
return
}
fmt.Printf("%s", resp.PartialNDF.Ndf)
if permHost != "" {
jww.ERROR.Printf("Unimplemented!")
}
fmt.Println("Enter --gwhost or --permhost and --cert please")
},
}
......@@ -81,6 +93,10 @@ func init() {
"Poll this gateway host:port for the NDF")
viper.BindPFlag("gwhost",
getNDFCmd.Flags().Lookup("gwhost"))
getNDFCmd.Flags().StringP("permhost", "", "",
"Poll this permissioning host:port for the NDF")
viper.BindPFlag("permhost",
getNDFCmd.Flags().Lookup("permhost"))
getNDFCmd.Flags().StringP("cert", "", "",
"Check with the TLS certificate at this path")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment