diff --git a/bindings/ud.go b/bindings/ud.go index b1ed7780270bf27306a0b9eb92e69b598a3e4391..2603a6287b4f2f493d23f8fa19e08fbb5e5e6c49 100644 --- a/bindings/ud.go +++ b/bindings/ud.go @@ -121,9 +121,12 @@ type UdNetworkStatus interface { // 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 UD server this call will connect with. +// You may use the UD server run by the xx network team by using E2e.GetUdCertFromNdf. // - contactFile is the data within a marshalled contact.Contact. This represents the // contact file of the server this call will connect with. +// You may use the UD server run by the xx network team by using E2e.GetUdContactFromNdf. // - address is the IP address of the UD server this call will connect with. +// You may use the UD server run by the xx network team by using E2e.GetUdAddressFromNdf. // // Returns // - A Manager object which is registered to the specified alternate UD service. diff --git a/cmd/ud.go b/cmd/ud.go index af002d63d5810d1ef870f56a775ec1d244828076..05de64802aa0497d9814e452546601d3ada12912 100644 --- a/cmd/ud.go +++ b/cmd/ud.go @@ -63,7 +63,7 @@ var udCmd = &cobra.Command{ jww.TRACE.Printf("[UD] Connected!") - address, cert, contactFile, err := getUdContactInfo(user) + cert, contactFile, address, err := getUdContactInfo(user) if err != nil { jww.FATAL.Panicf("Failed to load UD contact information from NDF: %+v", err) } @@ -73,7 +73,7 @@ var udCmd = &cobra.Command{ jww.TRACE.Printf("[UD] Registering identity %v...", userToRegister) userDiscoveryMgr, err := ud.NewOrLoad(user, user.GetComms(), user.NetworkFollowerStatus, userToRegister, nil, - cert, address, contactFile) + cert, contactFile, address) if err != nil { jww.FATAL.Panicf("Failed to load or create new UD manager: %+v", err) } @@ -254,10 +254,10 @@ var udCmd = &cobra.Command{ // getUdContactInfo is a helper function which retrieves the necessary information // to contact UD. -func getUdContactInfo(user *xxdk.E2e) (cert, address, contactFile []byte, err error) { +func getUdContactInfo(user *xxdk.E2e) (cert, contactFile []byte, address string, err error) { // Retrieve address - address = []byte(user.GetCmix().GetInstance().GetPartialNdf(). - Get().UDB.Address) + address = string([]byte(user.GetCmix().GetInstance().GetPartialNdf(). + Get().UDB.Address)) // Retrieve certificate cert = []byte(user.GetCmix().GetInstance().GetPartialNdf().Get().UDB.Cert) @@ -266,7 +266,7 @@ func getUdContactInfo(user *xxdk.E2e) (cert, address, contactFile []byte, err er udIdData := user.GetCmix().GetInstance().GetPartialNdf().Get().UDB.ID udId, err := id.Unmarshal(udIdData) if err != nil { - return nil, nil, nil, err + return nil, nil, "", err } // Retrieve DH Pub Key @@ -274,7 +274,7 @@ func getUdContactInfo(user *xxdk.E2e) (cert, address, contactFile []byte, err er var udDhPubKey *cyclic.Int err = udDhPubKey.UnmarshalJSON(udDhPubKeyData) if err != nil { - return nil, nil, nil, err + return nil, nil, "", err } // Construct contact