Skip to content
Snippets Groups Projects
Commit 5f402cf1 authored by Richard T. Carback III's avatar Richard T. Carback III
Browse files

Compilable version

parent 71ee7ed5
Branches
Tags
No related merge requests found
......@@ -21,7 +21,7 @@ import (
"gitlab.com/elixxir/client/interfaces/message"
"gitlab.com/elixxir/client/interfaces/params"
"gitlab.com/elixxir/client/switchboard"
w "gitlab.com/xx_network/primitives/id"
"gitlab.com/xx_network/primitives/id"
"io/ioutil"
"os"
"strconv"
......
......@@ -9,6 +9,7 @@
package cmd
import (
"fmt"
"github.com/spf13/cobra"
jww "github.com/spf13/jwalterweatherman"
"github.com/spf13/viper"
......@@ -17,6 +18,7 @@ import (
"gitlab.com/elixxir/client/switchboard"
"gitlab.com/elixxir/client/ud"
"gitlab.com/elixxir/primitives/fact"
"time"
)
// udCmd user discovery subcommand, allowing user lookup and registration for
......@@ -65,7 +67,7 @@ var udCmd = &cobra.Command{
})
}
err := client.StartNetworkFollower()
err = client.StartNetworkFollower()
if err != nil {
jww.FATAL.Panicf("%+v", err)
}
......@@ -83,7 +85,7 @@ var udCmd = &cobra.Command{
}
}
var facts []fact.Fact
var facts fact.FactList
phone := viper.GetString("addphone")
if phone != "" {
f, err := fact.NewFact(fact.Phone, phone)
......@@ -129,21 +131,24 @@ var udCmd = &cobra.Command{
lookupIDStr)
}
userDiscoveryMgr.Lookup(lookupID,
func(newContact contact.Contact, err Error) {
func(newContact contact.Contact, err error) {
if err != nil {
jww.FATAL.Panicf("%+v", err)
}
fmt.Printf(newContact.String())
cBytes, err := newContact.Marshal()
if err != nil {
jww.FATAL.Panicf("%+v", err)
}
fmt.Printf(string(cBytes))
},
time.Duration(10*time.Second))
time.Sleep(11 * time.Second)
}
usernameSrchStr := viper.GetString("searchusername")
emailSrchStr := viper.GetSTring("searchemail")
phoneSrchStr := viper.GetSTring("searchphone")
emailSrchStr := viper.GetString("searchemail")
phoneSrchStr := viper.GetString("searchphone")
var facts FactList
if usernameSrchStr != "" {
f, err := fact.NewFact(fact.Username, usernameSrchStr)
if err != nil {
......@@ -167,24 +172,28 @@ var udCmd = &cobra.Command{
}
if len(facts) == 0 {
client.StopNetworkFollowers(10 * time.Second)
client.StopNetworkFollower(10 * time.Second)
return
}
err := userDiscoveryMgr.Search(facts,
err = userDiscoveryMgr.Search(facts,
func(contacts []contact.Contact, err error) {
if err != nil {
jww.FATAL.Panicf("%+v", err)
}
for i := 0; i < len(contacts); i++ {
fmt.Printf(contacts[i].String())
cBytes, err := contacts[i].Marshal()
if err != nil {
jww.FATAL.Panicf("%+v", err)
}
fmt.Printf(string(cBytes))
}
}, 10*time.Second)
if err != nil {
jww.FATAL.Panicf("%+v", err)
}
time.Sleep(11 * time.Second)
client.StopNetworkFollowers(10 * time.Second)
client.StopNetworkFollower(10 * time.Second)
},
}
......
......@@ -24,7 +24,7 @@ require (
gitlab.com/elixxir/primitives v0.0.3-0.20210104223605-0e47af99d9d5
gitlab.com/xx_network/comms v0.0.4-0.20201222193955-56206d700360
gitlab.com/xx_network/crypto v0.0.5-0.20201217195719-cc31e1d1eee3
gitlab.com/xx_network/primitives v0.0.4-0.20201229212313-fe33d9809f27
gitlab.com/xx_network/primitives v0.0.4-0.20201216174909-808eb0fc97fc
golang.org/x/crypto v0.0.0-20201217014255-9d1352758620
golang.org/x/net v0.0.0-20201110031124-69a78807bb2b // indirect
golang.org/x/sys v0.0.0-20201214210602-f9fddec55a1e // indirect
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment