Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
client
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
elixxir
client
Merge requests
!297
Add GetNDF for gateways to the API
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Add GetNDF for gateways to the API
Josh/GetNdfApi
into
release
Overview
4
Commits
3
Pipelines
0
Changes
2
Merged
Josh Brooks
requested to merge
Josh/GetNdfApi
into
release
2 years ago
Overview
4
Commits
3
Pipelines
0
Changes
2
Expand
0
0
Merge request reports
Compare
release
version 2
0ba8accb
2 years ago
version 1
f4b33116
2 years ago
release (base)
and
latest version
latest version
23ed9e39
3 commits,
2 years ago
version 2
0ba8accb
2 commits,
2 years ago
version 1
f4b33116
1 commit,
2 years ago
2 files
+
65
−
21
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
2
Search (e.g. *.vue) (Ctrl+P)
cmd/getndf.go
+
17
−
21
Options
@@ -13,18 +13,18 @@ import (
"github.com/spf13/cobra"
jww
"github.com/spf13/jwalterweatherman"
"github.com/spf13/viper"
"gitlab.com/elixxir/comms/client"
// "gitlab.com/elixxir/crypto/contact"
// "gitlab.com/elixxir/client/interfaces/message"
// "gitlab.com/elixxir/client/switchboard"
// "gitlab.com/elixxir/client/ud"
// "gitlab.com/elixxir/primitives/fact"
"gitlab.com/elixxir/client/xxdk"
"gitlab.com/elixxir/comms/client"
"gitlab.com/xx_network/comms/connect"
//"time"
pb
"gitlab.com/elixxir/comms/mixmessages"
"gitlab.com/xx_network/primitives/id"
"gitlab.com/xx_network/primitives/id/ephemeral"
"gitlab.com/xx_network/primitives/utils"
)
@@ -99,38 +99,34 @@ var getNDFCmd = &cobra.Command{
opensslCertDL
)
}
params
:=
connect
.
GetDefaultHostParams
()
params
.
AuthEnabled
=
false
comms
,
_
:=
client
.
NewClientComms
(
nil
,
nil
,
nil
,
nil
)
// Gateway lookup
if
gwHost
!=
""
{
host
,
_
:=
connect
.
NewHost
(
&
id
.
TempGateway
,
gwHost
,
cert
,
params
)
dummyID
:=
ephemeral
.
ReservedIDs
[
0
]
pollMsg
:=
&
pb
.
GatewayPoll
{
Partial
:
&
pb
.
NDFHash
{
Hash
:
nil
,
},
LastUpdate
:
uint64
(
0
),
ReceptionID
:
dummyID
[
:
],
ClientVersion
:
[]
byte
(
xxdk
.
SEMVER
),
}
resp
,
err
:=
comms
.
SendPoll
(
host
,
pollMsg
)
ndfJSon
,
err
:=
xxdk
.
DownloadNdfFromGateway
(
gwHost
,
cert
)
if
err
!=
nil
{
jww
.
FATAL
.
Panicf
(
"Unable to poll %s for NDF:"
+
" %+v"
,
gwHost
,
err
)
jww
.
FATAL
.
Panicf
(
"%v"
,
err
)
}
fmt
.
Printf
(
"%s"
,
resp
.
PartialNDF
.
Ndf
)
fmt
.
Printf
(
"%s"
,
ndfJSon
)
return
}
if
permHost
!=
""
{
// Establish parameters for gRPC
params
:=
connect
.
GetDefaultHostParams
()
params
.
AuthEnabled
=
false
// Construct client's gRPC comms object
comms
,
_
:=
client
.
NewClientComms
(
nil
,
nil
,
nil
,
nil
)
// Establish host for scheduling server
host
,
_
:=
connect
.
NewHost
(
&
id
.
Permissioning
,
permHost
,
cert
,
params
)
// Construct a dummy message
pollMsg
:=
&
pb
.
NDFHash
{
Hash
:
[]
byte
(
"DummyUserRequest"
),
}
// Send request to scheduling and get response
resp
,
err
:=
comms
.
RequestNdf
(
host
,
pollMsg
)
if
err
!=
nil
{
jww
.
FATAL
.
Panicf
(
"Unable to ask %s for NDF:"
+
Loading