Merge pull request #1828 from gravitl/story/GRA-752

fix(GRA-752f): add address string to be sent to frontend
This commit is contained in:
Matthew R Kasun 2022-12-16 07:42:07 -05:00 committed by GitHub
commit 55f7a0eb02
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 2 deletions

View file

@ -48,8 +48,9 @@ type NodeCheckin struct {
// Iface struct for local interfaces of a node
type Iface struct {
Name string
Address net.IPNet
Name string `json:"name"`
Address net.IPNet `json:"address"`
AddressString string `json:"addressString"`
}
// Node - struct for node model

View file

@ -53,6 +53,9 @@ func Ping(client mqtt.Client, msg mqtt.Message) {
node.Version = checkin.Version
node.Connected = checkin.Connected
node.Interfaces = checkin.Ifaces
for i := range node.Interfaces {
node.Interfaces[i].AddressString = node.Interfaces[i].Address.String()
}
if err := logic.UpdateNode(&node, &node); err != nil {
logger.Log(0, "error updating node", node.Name, node.ID, " on checkin", err.Error())
return