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
Commits
994ee29a
Commit
994ee29a
authored
2 years ago
by
Josh Brooks
Browse files
Options
Downloads
Patches
Plain Diff
Respond to MR comments
parent
12e9906d
No related branches found
No related tags found
3 merge requests
!510
Release
,
!325
Support a single call for ud.NewOrLoad
,
!323
Xx 4019/new or load alt ud
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
bindings/e2e.go
+3
-3
3 additions, 3 deletions
bindings/e2e.go
bindings/ud.go
+6
-5
6 additions, 5 deletions
bindings/ud.go
ud/alternate.go
+3
-3
3 additions, 3 deletions
ud/alternate.go
ud/manager.go
+4
-4
4 additions, 4 deletions
ud/manager.go
with
16 additions
and
15 deletions
bindings/e2e.go
+
3
−
3
View file @
994ee29a
...
...
@@ -128,9 +128,9 @@ func (e *E2e) GetContact() []byte {
}
// GetUdAddressFromNdf retrieve the User Discovery's network address fom the NDF.
func
(
e
*
E2e
)
GetUdAddressFromNdf
()
[]
byte
{
return
[]
byte
(
e
.
api
.
GetCmix
()
.
GetInstance
()
.
GetPartialNdf
()
.
Get
()
.
UDB
.
Address
)
func
(
e
*
E2e
)
GetUdAddressFromNdf
()
string
{
return
e
.
api
.
GetCmix
()
.
GetInstance
()
.
GetPartialNdf
()
.
Get
()
.
UDB
.
Address
}
// GetUdCertFromNdf retrieves the User Discovery's TLS certificate from the NDF.
...
...
This diff is collapsed.
Click to expand it.
bindings/ud.go
+
6
−
5
View file @
994ee29a
...
...
@@ -120,15 +120,16 @@ type UdNetworkStatus interface {
// - networkValidationSig is a signature provided by the network (i.e. the client registrar).
// This may be nil, however UD may return an error in some cases (e.g. in a production level
// environment).
// - cert is the TLS certificate for the alternate UD server.
// - address is the IP address of the alternate UD server.
// - contactFile is the data within a marshalled contact.Contact.
// - cert is the TLS certificate for the UD server this call will connect with.
// - contactFile is the data within a marshalled contact.Contact. This represents the
// contact file of the server this call will connect with.
// - address is the IP address of the UD server this call will connect with.
//
// Returns
// - A Manager object which is registered to the specified alternate UD service.
func
NewOrLoadUd
(
e2eID
int
,
follower
UdNetworkStatus
,
username
string
,
registrationValidationSignature
,
cert
,
address
,
contactFile
[]
byte
)
(
cert
,
contactFile
[]
byte
,
address
string
)
(
*
UserDiscovery
,
error
)
{
// Get user from singleton
...
...
@@ -145,7 +146,7 @@ func NewOrLoadUd(e2eID int, follower UdNetworkStatus,
// Build manager
u
,
err
:=
ud
.
NewOrLoad
(
user
.
api
,
user
.
api
.
GetComms
(),
UdNetworkStatusFn
,
username
,
registrationValidationSignature
,
cert
,
address
,
contactFile
)
cert
,
contactFile
,
address
)
if
err
!=
nil
{
return
nil
,
err
}
...
...
This diff is collapsed.
Click to expand it.
ud/alternate.go
+
3
−
3
View file @
994ee29a
...
...
@@ -21,8 +21,8 @@ type alternateUd struct {
// user discovery service.
//
// To undo this operation, use UnsetAlternativeUserDiscovery.
func
(
m
*
Manager
)
setAlternateUserDiscovery
(
altCert
,
altAddress
,
contactFile
[]
byte
)
error
{
func
(
m
*
Manager
)
setAlternateUserDiscovery
(
altCert
,
contactFile
[]
byte
,
altAddress
string
)
error
{
params
:=
connect
.
GetDefaultHostParams
()
params
.
AuthEnabled
=
false
...
...
@@ -37,7 +37,7 @@ func (m *Manager) setAlternateUserDiscovery(altCert, altAddress,
}
// Add a new host and return it if it does not already exist
host
,
err
:=
m
.
comms
.
AddHost
(
udID
,
string
(
altAddress
)
,
host
,
err
:=
m
.
comms
.
AddHost
(
udID
,
altAddress
,
altCert
,
params
)
if
err
!=
nil
{
return
errors
.
WithMessage
(
err
,
"User Discovery host object could "
+
...
...
This diff is collapsed.
Click to expand it.
ud/manager.go
+
4
−
4
View file @
994ee29a
...
...
@@ -58,14 +58,14 @@ type Manager struct {
// - networkValidationSig is a signature provided by the network (i.e. the client registrar). This may
// be nil, however UD may return an error in some cases (e.g. in a production level environment).
// - customCert is the TLS certificate for the alternate UD server.
// - customAddress is the IP address of the alternate UD server.
// - customContactFile is the data within a marshalled contact.Contact.
// - customAddress is the IP address of the alternate UD server.
//
// Returns
// - A Manager object which is registered to the specified alternate UD service.
func
NewOrLoad
(
user
udE2e
,
comms
Comms
,
follower
udNetworkStatus
,
username
string
,
networkValidationSig
[]
byte
,
customCert
,
customAddress
,
customContactFile
[]
byte
)
(
*
Manager
,
error
)
{
username
string
,
networkValidationSig
,
customCert
,
customContactFile
[]
byte
,
customAddress
string
)
(
*
Manager
,
error
)
{
jww
.
INFO
.
Println
(
"ud.NewOrLoad()"
)
...
...
@@ -76,7 +76,7 @@ func NewOrLoad(user udE2e, comms Comms, follower udNetworkStatus,
}
// Set alternative user discovery
err
=
m
.
setAlternateUserDiscovery
(
customCert
,
custom
Address
,
customContactFile
)
err
=
m
.
setAlternateUserDiscovery
(
customCert
,
custom
ContactFile
,
customAddress
)
if
err
!=
nil
{
return
nil
,
err
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment