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
2fbd5553
Commit
2fbd5553
authored
Aug 8, 2022
by
Josh Brooks
Browse files
Options
Downloads
Patches
Plain Diff
Revert "Fix contact marshal mismatch bug"
This reverts commit
abc57b72
.
parent
abc57b72
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
+10
-11
10 additions, 11 deletions
ud/alternate.go
ud/manager.go
+1
-1
1 addition, 1 deletion
ud/manager.go
with
16 additions
and
17 deletions
bindings/ud.go
+
5
−
5
View file @
2fbd5553
...
@@ -125,13 +125,13 @@ func LoadOrNewUserDiscovery(e2eID int, follower UdNetworkStatus,
...
@@ -125,13 +125,13 @@ func LoadOrNewUserDiscovery(e2eID int, follower UdNetworkStatus,
}
}
// Construct callback
// Construct callback
u
dNetworkStatusFn
:=
func
()
xxdk
.
Status
{
U
dNetworkStatusFn
:=
func
()
xxdk
.
Status
{
return
xxdk
.
Status
(
follower
.
UdNetworkStatus
())
return
xxdk
.
Status
(
follower
.
UdNetworkStatus
())
}
}
// Build manager
// Build manager
u
,
err
:=
ud
.
LoadOrNewManager
(
user
.
api
,
user
.
api
.
GetComms
(),
u
,
err
:=
ud
.
LoadOrNewManager
(
user
.
api
,
user
.
api
.
GetComms
(),
u
dNetworkStatusFn
,
username
,
registrationValidationSignature
)
U
dNetworkStatusFn
,
username
,
registrationValidationSignature
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
...
@@ -156,7 +156,7 @@ func LoadOrNewUserDiscovery(e2eID int, follower UdNetworkStatus,
...
@@ -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).
// 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.
// - altCert is the TLS certificate for the alternate UD server.
// - altAddress is the IP address of the alternate UD server.
// - altAddress is the IP address of the alternate UD server.
// - marshalledContact is
a JSON
marshalled contact.Contact.
// - marshalledContact is
the data within a
marshalled contact.Contact.
//
//
// Returns
// Returns
// - A Manager object which is registered to the specified alternate UD service.
// - A Manager object which is registered to the specified alternate UD service.
...
@@ -172,13 +172,13 @@ func LoadOrNewAlternateUserDiscovery(e2eID int, follower UdNetworkStatus,
...
@@ -172,13 +172,13 @@ func LoadOrNewAlternateUserDiscovery(e2eID int, follower UdNetworkStatus,
}
}
// Construct callback
// Construct callback
u
dNetworkStatusFn
:=
func
()
xxdk
.
Status
{
U
dNetworkStatusFn
:=
func
()
xxdk
.
Status
{
return
xxdk
.
Status
(
follower
.
UdNetworkStatus
())
return
xxdk
.
Status
(
follower
.
UdNetworkStatus
())
}
}
// Build manager
// Build manager
u
,
err
:=
ud
.
LoadOrNewAlternateUserDiscovery
(
user
.
api
,
user
.
api
.
GetComms
(),
u
,
err
:=
ud
.
LoadOrNewAlternateUserDiscovery
(
user
.
api
,
user
.
api
.
GetComms
(),
u
dNetworkStatusFn
,
username
,
registrationValidationSignature
,
U
dNetworkStatusFn
,
username
,
registrationValidationSignature
,
altCert
,
altAddress
,
marshalledContact
)
altCert
,
altAddress
,
marshalledContact
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
...
...
This diff is collapsed.
Click to expand it.
ud/alternate.go
+
10
−
11
View file @
2fbd5553
package
ud
package
ud
import
(
import
(
"encoding/json"
"github.com/pkg/errors"
"github.com/pkg/errors"
"gitlab.com/elixxir/crypto/contact"
"gitlab.com/elixxir/crypto/contact"
"gitlab.com/xx_network/comms/connect"
"gitlab.com/xx_network/comms/connect"
"gitlab.com/xx_network/primitives/id"
)
)
// alternateUd is an alternative user discovery service.
// alternateUd is an alternative user discovery service.
...
@@ -26,28 +26,27 @@ func (m *Manager) setAlternateUserDiscovery(altCert, altAddress,
...
@@ -26,28 +26,27 @@ func (m *Manager) setAlternateUserDiscovery(altCert, altAddress,
params
:=
connect
.
GetDefaultHostParams
()
params
:=
connect
.
GetDefaultHostParams
()
params
.
AuthEnabled
=
false
params
.
AuthEnabled
=
false
c
:=
&
contact
.
Contact
{}
udIdBytes
,
dhPubKey
,
err
:=
contact
.
ReadContactFromFile
(
contactFile
)
err
:=
json
.
Unmarshal
(
contactFile
,
c
)
if
err
!=
nil
{
if
err
!=
nil
{
return
errors
.
Errorf
(
"Failed to unmarshal contact file: %v"
,
err
)
return
err
}
udID
,
err
:=
id
.
Unmarshal
(
udIdBytes
)
if
err
!=
nil
{
return
err
}
}
// Add a new host and return it if it does not already exist
// Add a new host and return it if it does not already exist
host
,
err
:=
m
.
comms
.
AddHost
(
c
.
ID
,
string
(
altAddress
),
host
,
err
:=
m
.
comms
.
AddHost
(
ud
ID
,
string
(
altAddress
),
altCert
,
params
)
altCert
,
params
)
if
err
!=
nil
{
if
err
!=
nil
{
return
errors
.
WithMessage
(
err
,
"User Discovery host object could "
+
return
errors
.
WithMessage
(
err
,
"User Discovery host object could "
+
"not be constructed."
)
"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
{
m
.
alternativeUd
=
&
alternateUd
{
host
:
host
,
host
:
host
,
dhPubKey
:
dhPub
Json
,
dhPubKey
:
dhPub
Key
,
}
}
return
nil
return
nil
...
...
This diff is collapsed.
Click to expand it.
ud/manager.go
+
1
−
1
View file @
2fbd5553
...
@@ -140,7 +140,7 @@ func NewManagerFromBackup(user udE2e, comms Comms, follower udNetworkStatus,
...
@@ -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).
// 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.
// - altCert is the TLS certificate for the alternate UD server.
// - altAddress is the IP address of the alternate UD server.
// - altAddress is the IP address of the alternate UD server.
// - marshalledContact is
a JSON
marshalled contact.Contact.
// - marshalledContact is
the data within a
marshalled contact.Contact.
//
//
// Returns
// Returns
// - A Manager object which is registered to the specified alternate UD service.
// - A Manager object which is registered to the specified alternate UD service.
...
...
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