Browse Source

set listenport in hostnetwork info (#2559)

Matthew R Kasun 1 year ago
parent
commit
3783d01ae5
1 changed files with 2 additions and 3 deletions
  1. 2 3
      logic/peers.go

+ 2 - 3
logic/peers.go

@@ -173,14 +173,13 @@ func GetPeerUpdateForHost(network string, host *models.Host, allNodes []models.N
 				peerConfig.AllowedIPs = allowedips // only append allowed IPs if valid connection
 			}
 
-			peerPort := GetPeerListenPort(peerHost)
 			var nodePeer wgtypes.PeerConfig
 			if _, ok := peerIndexMap[peerHost.PublicKey.String()]; !ok {
 				hostPeerUpdate.Peers = append(hostPeerUpdate.Peers, peerConfig)
 				peerIndexMap[peerHost.PublicKey.String()] = len(hostPeerUpdate.Peers) - 1
 				hostPeerUpdate.HostNetworkInfo[peerHost.PublicKey.String()] = models.HostNetworkInfo{
 					Interfaces: peerHost.Interfaces,
-					ListenPort: peerPort,
+					ListenPort: peerHost.ListenPort,
 					IsStatic:   peerHost.IsStatic,
 				}
 				nodePeer = peerConfig
@@ -191,7 +190,7 @@ func GetPeerUpdateForHost(network string, host *models.Host, allNodes []models.N
 				hostPeerUpdate.Peers[peerIndexMap[peerHost.PublicKey.String()]].Remove = false
 				hostPeerUpdate.HostNetworkInfo[peerHost.PublicKey.String()] = models.HostNetworkInfo{
 					Interfaces: peerHost.Interfaces,
-					ListenPort: peerPort,
+					ListenPort: peerHost.ListenPort,
 					IsStatic:   peerHost.IsStatic,
 				}
 				nodePeer = hostPeerUpdate.Peers[peerIndexMap[peerHost.PublicKey.String()]]