refactored all grpc to be uniform

This commit is contained in:
0xdcarns
2022-01-10 19:36:13 -05:00
parent 75a20b70cf
commit 0569358cbd
6 changed files with 72 additions and 58 deletions

View File

@@ -101,9 +101,15 @@ func GetPeers(macaddress string, network string, server string, dualstack bool,
// Instantiate the BlogServiceClient with our client connection to the server
wcclient = nodepb.NewNodeServiceClient(conn)
nodeData, err := json.Marshal(&nodecfg)
if err != nil {
ncutils.PrintLog("could not parse node data from config during peer fetch for network "+network, 1)
return peers, hasGateway, gateways, err
}
req := &nodepb.Object{
Data: macaddress + "###" + network,
Type: nodepb.STRING_TYPE,
Data: string(nodeData),
Type: nodepb.NODE_TYPE,
}
ctx, err := auth.SetJWT(wcclient, network)
@@ -274,9 +280,15 @@ func GetExtPeers(macaddress string, network string, server string, dualstack boo
// Instantiate the BlogServiceClient with our client connection to the server
wcclient = nodepb.NewNodeServiceClient(conn)
nodeData, err := json.Marshal(&nodecfg)
if err != nil {
ncutils.PrintLog("could not parse node data from config during peer fetch for network "+network, 1)
return peers, err
}
req := &nodepb.Object{
Data: macaddress + "###" + network,
Type: nodepb.STRING_TYPE,
Data: string(nodeData),
Type: nodepb.NODE_TYPE,
}
ctx, err := auth.SetJWT(wcclient, network)