Browse Source

NET-528: add host static info to peer update (#2550)

* set isstatic field on peer update

* remove static check for peer port
Abhishek K 1 year ago
parent
commit
31fcc8cd6d
2 changed files with 3 additions and 0 deletions
  1. 2 0
      logic/peers.go
  2. 1 0
      models/metrics.go

+ 2 - 0
logic/peers.go

@@ -181,6 +181,7 @@ func GetPeerUpdateForHost(network string, host *models.Host, allNodes []models.N
 				hostPeerUpdate.HostNetworkInfo[peerHost.PublicKey.String()] = models.HostNetworkInfo{
 				hostPeerUpdate.HostNetworkInfo[peerHost.PublicKey.String()] = models.HostNetworkInfo{
 					Interfaces: peerHost.Interfaces,
 					Interfaces: peerHost.Interfaces,
 					ListenPort: peerPort,
 					ListenPort: peerPort,
+					IsStatic:   peerHost.IsStatic,
 				}
 				}
 				nodePeer = peerConfig
 				nodePeer = peerConfig
 			} else {
 			} else {
@@ -191,6 +192,7 @@ func GetPeerUpdateForHost(network string, host *models.Host, allNodes []models.N
 				hostPeerUpdate.HostNetworkInfo[peerHost.PublicKey.String()] = models.HostNetworkInfo{
 				hostPeerUpdate.HostNetworkInfo[peerHost.PublicKey.String()] = models.HostNetworkInfo{
 					Interfaces: peerHost.Interfaces,
 					Interfaces: peerHost.Interfaces,
 					ListenPort: peerPort,
 					ListenPort: peerPort,
+					IsStatic:   peerHost.IsStatic,
 				}
 				}
 				nodePeer = hostPeerUpdate.Peers[peerIndexMap[peerHost.PublicKey.String()]]
 				nodePeer = hostPeerUpdate.Peers[peerIndexMap[peerHost.PublicKey.String()]]
 			}
 			}

+ 1 - 0
models/metrics.go

@@ -44,6 +44,7 @@ type HostInfoMap map[string]HostNetworkInfo
 type HostNetworkInfo struct {
 type HostNetworkInfo struct {
 	Interfaces []Iface `json:"interfaces" yaml:"interfaces"`
 	Interfaces []Iface `json:"interfaces" yaml:"interfaces"`
 	ListenPort int     `json:"listen_port" yaml:"listen_port"`
 	ListenPort int     `json:"listen_port" yaml:"listen_port"`
+	IsStatic   bool    `json:"is_static"`
 }
 }
 
 
 // PeerMap - peer map for ids and addresses in metrics
 // PeerMap - peer map for ids and addresses in metrics