add all local interfaces to node

This commit is contained in:
Matthew R. Kasun
2022-11-28 11:16:19 -05:00
parent 2a69df0979
commit 6b18ff57c9
5 changed files with 55 additions and 0 deletions

View File

@@ -140,6 +140,14 @@ func Hello(nodeCfg *config.ClientConfig) {
var checkin models.NodeCheckin
checkin.Version = ncutils.Version
checkin.Connected = nodeCfg.Node.Connected
ip, err := getInterfaces()
if err != nil {
logger.Log(0, "failed to retrieve local interfaces", err.Error())
} else {
nodeCfg.Node.Interfaces = *ip
config.Write(nodeCfg, nodeCfg.Network)
}
checkin.Ifaces = nodeCfg.Node.Interfaces
data, err := json.Marshal(checkin)
if err != nil {
logger.Log(0, "unable to marshal checkin data", err.Error())