mirror of
https://github.com/gravitl/netmaker.git
synced 2025-09-11 15:44:52 +08:00
local interfaces
This commit is contained in:
parent
4df672de68
commit
c5919b347c
3 changed files with 10 additions and 1 deletions
2
go.mod
2
go.mod
|
@ -46,7 +46,7 @@ require (
|
||||||
golang.org/x/term v0.0.0-20220722155259-a9ba230a4035
|
golang.org/x/term v0.0.0-20220722155259-a9ba230a4035
|
||||||
)
|
)
|
||||||
|
|
||||||
require github.com/matryer/is v1.4.0 // indirect
|
require github.com/matryer/is v1.4.0
|
||||||
|
|
||||||
require (
|
require (
|
||||||
cloud.google.com/go/compute v1.7.0 // indirect
|
cloud.google.com/go/compute v1.7.0 // indirect
|
||||||
|
|
|
@ -43,6 +43,13 @@ var seededRand *rand.Rand = rand.New(
|
||||||
type NodeCheckin struct {
|
type NodeCheckin struct {
|
||||||
Version string
|
Version string
|
||||||
Connected string
|
Connected string
|
||||||
|
Ifaces []Iface
|
||||||
|
}
|
||||||
|
|
||||||
|
// Iface struct for local interfaces of a node
|
||||||
|
type Iface struct {
|
||||||
|
Name string
|
||||||
|
Address net.IPNet
|
||||||
}
|
}
|
||||||
|
|
||||||
// Node - struct for node model
|
// Node - struct for node model
|
||||||
|
@ -52,6 +59,7 @@ type Node struct {
|
||||||
Address string `json:"address" bson:"address" yaml:"address" validate:"omitempty,ipv4"`
|
Address string `json:"address" bson:"address" yaml:"address" validate:"omitempty,ipv4"`
|
||||||
Address6 string `json:"address6" bson:"address6" yaml:"address6" validate:"omitempty,ipv6"`
|
Address6 string `json:"address6" bson:"address6" yaml:"address6" validate:"omitempty,ipv6"`
|
||||||
LocalAddress string `json:"localaddress" bson:"localaddress" yaml:"localaddress" validate:"omitempty"`
|
LocalAddress string `json:"localaddress" bson:"localaddress" yaml:"localaddress" validate:"omitempty"`
|
||||||
|
Interfaces []Iface `json:"interfaces" yaml:"interfaces"`
|
||||||
Name string `json:"name" bson:"name" yaml:"name" validate:"omitempty,max=62,in_charset"`
|
Name string `json:"name" bson:"name" yaml:"name" validate:"omitempty,max=62,in_charset"`
|
||||||
NetworkSettings Network `json:"networksettings" bson:"networksettings" yaml:"networksettings" validate:"-"`
|
NetworkSettings Network `json:"networksettings" bson:"networksettings" yaml:"networksettings" validate:"-"`
|
||||||
ListenPort int32 `json:"listenport" bson:"listenport" yaml:"listenport" validate:"omitempty,numeric,min=1024,max=65535"`
|
ListenPort int32 `json:"listenport" bson:"listenport" yaml:"listenport" validate:"omitempty,numeric,min=1024,max=65535"`
|
||||||
|
|
|
@ -52,6 +52,7 @@ func Ping(client mqtt.Client, msg mqtt.Message) {
|
||||||
node.SetLastCheckIn()
|
node.SetLastCheckIn()
|
||||||
node.Version = checkin.Version
|
node.Version = checkin.Version
|
||||||
node.Connected = checkin.Connected
|
node.Connected = checkin.Connected
|
||||||
|
node.Interfaces = checkin.Ifaces
|
||||||
if err := logic.UpdateNode(&node, &node); err != nil {
|
if err := logic.UpdateNode(&node, &node); err != nil {
|
||||||
logger.Log(0, "error updating node", node.Name, node.ID, " on checkin", err.Error())
|
logger.Log(0, "error updating node", node.Name, node.ID, " on checkin", err.Error())
|
||||||
return
|
return
|
||||||
|
|
Loading…
Add table
Reference in a new issue