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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
elixxir
client
Commits
abc57b72
Commit
abc57b72
authored
Aug 8, 2022
by
Josh Brooks
Browse files
Options
Downloads
Patches
Plain Diff
Fix contact marshal mismatch bug
parent
95f96c9e
No related branches found
No related tags found
3 merge requests
!510
Release
,
!324
Fix contact marshal mismatch bug
,
!323
Xx 4019/new or load alt ud
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
bindings/ud.go
+5
-5
5 additions, 5 deletions
bindings/ud.go
ud/alternate.go
+11
-10
11 additions, 10 deletions
ud/alternate.go
ud/manager.go
+1
-1
1 addition, 1 deletion
ud/manager.go
with
17 additions
and
16 deletions
bindings/ud.go
+
5
−
5
View file @
abc57b72
...
...
@@ -125,13 +125,13 @@ func LoadOrNewUserDiscovery(e2eID int, follower UdNetworkStatus,
}
// Construct callback
U
dNetworkStatusFn
:=
func
()
xxdk
.
Status
{
u
dNetworkStatusFn
:=
func
()
xxdk
.
Status
{
return
xxdk
.
Status
(
follower
.
UdNetworkStatus
())
}
// Build manager
u
,
err
:=
ud
.
LoadOrNewManager
(
user
.
api
,
user
.
api
.
GetComms
(),
U
dNetworkStatusFn
,
username
,
registrationValidationSignature
)
u
dNetworkStatusFn
,
username
,
registrationValidationSignature
)
if
err
!=
nil
{
return
nil
,
err
}
...
...
@@ -156,7 +156,7 @@ func LoadOrNewUserDiscovery(e2eID int, follower UdNetworkStatus,
// be nil, however UD may return an error in some cases (e.g. in a production level environment).
// - altCert is the TLS certificate for the alternate UD server.
// - altAddress is the IP address of the alternate UD server.
// - marshalledContact is
the data within a
marshalled contact.Contact.
// - marshalledContact is
a JSON
marshalled contact.Contact.
//
// Returns
// - A Manager object which is registered to the specified alternate UD service.
...
...
@@ -172,13 +172,13 @@ func LoadOrNewAlternateUserDiscovery(e2eID int, follower UdNetworkStatus,
}
// Construct callback
U
dNetworkStatusFn
:=
func
()
xxdk
.
Status
{
u
dNetworkStatusFn
:=
func
()
xxdk
.
Status
{
return
xxdk
.
Status
(
follower
.
UdNetworkStatus
())
}
// Build manager
u
,
err
:=
ud
.
LoadOrNewAlternateUserDiscovery
(
user
.
api
,
user
.
api
.
GetComms
(),
U
dNetworkStatusFn
,
username
,
registrationValidationSignature
,
u
dNetworkStatusFn
,
username
,
registrationValidationSignature
,
altCert
,
altAddress
,
marshalledContact
)
if
err
!=
nil
{
return
nil
,
err
...
...
This diff is collapsed.
Click to expand it.
ud/alternate.go
+
11
−
10
View file @
abc57b72
package
ud
import
(
"encoding/json"
"github.com/pkg/errors"
"gitlab.com/elixxir/crypto/contact"
"gitlab.com/xx_network/comms/connect"
"gitlab.com/xx_network/primitives/id"
)
// alternateUd is an alternative user discovery service.
...
...
@@ -26,27 +26,28 @@ func (m *Manager) setAlternateUserDiscovery(altCert, altAddress,
params
:=
connect
.
GetDefaultHostParams
()
params
.
AuthEnabled
=
false
udIdBytes
,
dhPubKey
,
err
:=
contact
.
ReadContactFromFile
(
contactFile
)
c
:=
&
contact
.
Contact
{}
err
:=
json
.
Unmarshal
(
contactFile
,
c
)
if
err
!=
nil
{
return
err
}
udID
,
err
:=
id
.
Unmarshal
(
udIdBytes
)
if
err
!=
nil
{
return
err
return
errors
.
Errorf
(
"Failed to unmarshal contact file: %v"
,
err
)
}
// Add a new host and return it if it does not already exist
host
,
err
:=
m
.
comms
.
AddHost
(
ud
ID
,
string
(
altAddress
),
host
,
err
:=
m
.
comms
.
AddHost
(
c
.
ID
,
string
(
altAddress
),
altCert
,
params
)
if
err
!=
nil
{
return
errors
.
WithMessage
(
err
,
"User Discovery host object could "
+
"not be constructed."
)
}
dhPubJson
,
err
:=
c
.
DhPubKey
.
MarshalJSON
()
if
err
!=
nil
{
return
errors
.
Errorf
(
"Failed to marshal Diffie-Helman public key: %v"
,
err
)
}
m
.
alternativeUd
=
&
alternateUd
{
host
:
host
,
dhPubKey
:
dhPub
Key
,
dhPubKey
:
dhPub
Json
,
}
return
nil
...
...
This diff is collapsed.
Click to expand it.
ud/manager.go
+
1
−
1
View file @
abc57b72
...
...
@@ -140,7 +140,7 @@ func NewManagerFromBackup(user udE2e, comms Comms, follower udNetworkStatus,
// be nil, however UD may return an error in some cases (e.g. in a production level environment).
// - altCert is the TLS certificate for the alternate UD server.
// - altAddress is the IP address of the alternate UD server.
// - marshalledContact is
the data within a
marshalled contact.Contact.
// - marshalledContact is
a JSON
marshalled contact.Contact.
//
// Returns
// - A Manager object which is registered to the specified alternate UD service.
...
...
This diff is collapsed.
Click to expand it.
Josh Brooks
@joshemb
mentioned in commit
2fbd5553
·
Aug 8, 2022
mentioned in commit
2fbd5553
mentioned in commit 2fbd5553798d45f6980a7d382add171553bfa763
Toggle commit list
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