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
4a9df9a9
Commit
4a9df9a9
authored
2 years ago
by
Josh Brooks
Browse files
Options
Downloads
Patches
Plain Diff
Improve documentation
parent
7edf36da
No related branches found
No related tags found
2 merge requests
!510
Release
,
!323
Xx 4019/new or load alt ud
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
bindings/ud.go
+22
-18
22 additions, 18 deletions
bindings/ud.go
ud/manager.go
+6
-6
6 additions, 6 deletions
ud/manager.go
with
28 additions
and
24 deletions
bindings/ud.go
+
22
−
18
View file @
4a9df9a9
...
...
@@ -105,7 +105,10 @@ type UdNetworkStatus interface {
// Manager functions //
////////////////////////////////////////////////////////////////////////////////
// LoadOrNewUserDiscovery creates a bindings-level user discovery manager.
// NewOrLoadUdFromNdf loads an existing Manager from storage or creates a
// new one if there is no extant storage information. This will default to connecting with
// the xx network's UD server as found in the NDF. For connecting to a custom server, use
// NewOrLoadUd.
//
// Parameters:
// - e2eID - e2e object ID in the tracker
...
...
@@ -113,8 +116,9 @@ type UdNetworkStatus interface {
// - username - the username the user wants to register with UD.
// If the user is already registered, this field may be blank
// - registrationValidationSignature - the signature provided by the xx network.
// This signature is optional for other consumers who deploy their own UD.
func
LoadOrNewUserDiscovery
(
e2eID
int
,
follower
UdNetworkStatus
,
// This may be nil, however UD may return an error in some cases (e.g. in a production level
// environment).
func
NewOrLoadUdFromNdf
(
e2eID
int
,
follower
UdNetworkStatus
,
username
string
,
registrationValidationSignature
[]
byte
)
(
*
UserDiscovery
,
error
)
{
...
...
@@ -140,29 +144,29 @@ func LoadOrNewUserDiscovery(e2eID int, follower UdNetworkStatus,
return
udTrackerSingleton
.
make
(
u
),
nil
}
//
LoadOrNewAlternateUserDiscovery
loads an existing Manager from storage or creates a
// new one if there is no extant storage information. This is different from NewOrLoadFromNdf
//
NewOrLoadUd
loads an existing Manager from storage or creates a
// new one if there is no extant storage information. This is different from NewOrLoad
Ud
FromNdf
// in that it allows the user to provide alternate User Discovery contact information.
// These parameters may be used to contact a separate UD server than the one run by the
// xx network team, one the user or a third-party may operate.
//
// Params
// -
user is an interface that adheres to the xxdk.E2e object.
// -
comms is an interface that adheres to client.Comms object.
// -
follower is a method off of xxdk.Cmix which returns the network follower's status
.
//
- username is the name o
f the user
as it is
registered
with UD. This will be what the end user
//
provides if through the bindings
.
//
- 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).
// -
alt
Cert is the TLS certificate for the alternate UD server.
// -
alt
Address is the IP address of the alternate UD server.
// -
marshalled
Contact is the data within a marshalled contact.Contact.
// -
e2eID - e2e object ID in the tracker
// -
follower - network follower func wrapped in UdNetworkStatus
// -
username - the username the user wants to register with UD
.
//
I
f the user
is already
registered
, this field may be blank
//
- 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).
// -
custom
Cert is the TLS certificate for the alternate UD server.
// -
custom
Address is the IP address of the alternate UD server.
// -
custom
Contact
File
is the data within a marshalled contact.Contact.
//
// Returns
// - A Manager object which is registered to the specified alternate UD service.
func
LoadOrNewAlternateUserDiscovery
(
e2eID
int
,
follower
UdNetworkStatus
,
func
NewOrLoadUd
(
e2eID
int
,
follower
UdNetworkStatus
,
username
string
,
registrationValidationSignature
,
altCert
,
altAddress
,
marshalled
Contact
[]
byte
)
(
customCert
,
customAddress
,
custom
Contact
File
[]
byte
)
(
*
UserDiscovery
,
error
)
{
// Get user from singleton
...
...
@@ -179,7 +183,7 @@ func LoadOrNewAlternateUserDiscovery(e2eID int, follower UdNetworkStatus,
// Build manager
u
,
err
:=
ud
.
NewOrLoad
(
user
.
api
,
user
.
api
.
GetComms
(),
UdNetworkStatusFn
,
username
,
registrationValidationSignature
,
altCert
,
altAddress
,
marshalled
Contact
)
customCert
,
customAddress
,
custom
Contact
File
)
if
err
!=
nil
{
return
nil
,
err
}
...
...
This diff is collapsed.
Click to expand it.
ud/manager.go
+
6
−
6
View file @
4a9df9a9
...
...
@@ -141,15 +141,15 @@ func NewManagerFromBackup(user udE2e, comms Comms, follower udNetworkStatus,
// provides if through the bindings.
// - 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).
// -
alt
Cert is the TLS certificate for the alternate UD server.
// -
alt
Address is the IP address of the alternate UD server.
// -
marshalled
Contact is the data within a marshalled contact.Contact.
// -
custom
Cert is the TLS certificate for the alternate UD server.
// -
custom
Address is the IP address of the alternate UD server.
// -
custom
Contact
File
is the data within a marshalled contact.Contact.
//
// 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
,
altCert
,
altAddress
,
marshalled
Contact
[]
byte
)
(
*
Manager
,
error
)
{
username
string
,
networkValidationSig
[]
byte
,
customCert
,
customAddress
,
custom
Contact
File
[]
byte
)
(
*
Manager
,
error
)
{
jww
.
INFO
.
Println
(
"ud.NewOrLoad()"
)
...
...
@@ -160,7 +160,7 @@ func NewOrLoad(user udE2e, comms Comms, follower udNetworkStatus,
}
// Set alternative user discovery
err
=
m
.
setAlternateUserDiscovery
(
altCert
,
altAddress
,
marshalled
Contact
)
err
=
m
.
setAlternateUserDiscovery
(
customCert
,
customAddress
,
custom
Contact
File
)
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