mirror of
https://github.com/gravitl/netmaker.git
synced 2025-09-09 14:46:36 +08:00
broadcast port changes
This commit is contained in:
parent
1a67b4e49b
commit
eca3a16f9a
1 changed files with 8 additions and 1 deletions
|
@ -446,12 +446,19 @@ func handleHostCheckin(h, currentHost *models.Host) bool {
|
|||
ifaceDelta := len(h.Interfaces) != len(currentHost.Interfaces) ||
|
||||
!h.EndpointIP.Equal(currentHost.EndpointIP) ||
|
||||
(len(h.NatType) > 0 && h.NatType != currentHost.NatType) ||
|
||||
h.DefaultInterface != currentHost.DefaultInterface
|
||||
h.DefaultInterface != currentHost.DefaultInterface ||
|
||||
(h.ListenPort != 0 && h.ListenPort != currentHost.ListenPort) || (h.WgPublicListenPort != 0 && h.WgPublicListenPort != currentHost.WgPublicListenPort)
|
||||
if ifaceDelta { // only save if something changes
|
||||
currentHost.EndpointIP = h.EndpointIP
|
||||
currentHost.Interfaces = h.Interfaces
|
||||
currentHost.DefaultInterface = h.DefaultInterface
|
||||
currentHost.NatType = h.NatType
|
||||
if h.ListenPort != 0 {
|
||||
currentHost.ListenPort = h.ListenPort
|
||||
}
|
||||
if h.WgPublicListenPort != 0 {
|
||||
currentHost.WgPublicListenPort = h.WgPublicListenPort
|
||||
}
|
||||
if err := logic.UpsertHost(currentHost); err != nil {
|
||||
slog.Error("failed to update host after check-in", "name", h.Name, "id", h.ID, "error", err)
|
||||
return false
|
||||
|
|
Loading…
Add table
Reference in a new issue