From 994ee29a888fb86fded0284f6c851ecb64aede7f Mon Sep 17 00:00:00 2001
From: joshemb <josh@elixxir.io>
Date: Tue, 9 Aug 2022 09:56:56 -0700
Subject: [PATCH] Respond to MR comments

---
 bindings/e2e.go |  6 +++---
 bindings/ud.go  | 11 ++++++-----
 ud/alternate.go |  6 +++---
 ud/manager.go   |  8 ++++----
 4 files changed, 16 insertions(+), 15 deletions(-)

diff --git a/bindings/e2e.go b/bindings/e2e.go
index 1a89bd8b3..83d5985f0 100644
--- a/bindings/e2e.go
+++ b/bindings/e2e.go
@@ -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.
diff --git a/bindings/ud.go b/bindings/ud.go
index b967aa053..b1ed77802 100644
--- a/bindings/ud.go
+++ b/bindings/ud.go
@@ -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
 	}
diff --git a/ud/alternate.go b/ud/alternate.go
index 7fe78e696..26ba501e4 100644
--- a/ud/alternate.go
+++ b/ud/alternate.go
@@ -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 "+
diff --git a/ud/manager.go b/ud/manager.go
index 91ba31ec0..f6aa78e9b 100644
--- a/ud/manager.go
+++ b/ud/manager.go
@@ -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, customAddress, customContactFile)
+	err = m.setAlternateUserDiscovery(customCert, customContactFile, customAddress)
 	if err != nil {
 		return nil, err
 	}
-- 
GitLab