|
@@ -90,6 +90,7 @@ func GetProxyUpdateForHost(ctx context.Context, host *models.Host) (models.Proxy
|
|
|
currPeerConf = models.PeerConf{
|
|
|
Proxy: peerHost.ProxyEnabled,
|
|
|
PublicListenPort: int32(GetPeerListenPort(peerHost)),
|
|
|
+ ProxyListenPort: GetProxyListenPort(peerHost),
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -274,10 +275,11 @@ func GetPeerUpdateForHost(ctx context.Context, network string, host *models.Host
|
|
|
hostPeerUpdate.Peers = append(hostPeerUpdate.Peers, peerConfig)
|
|
|
peerIndexMap[peerHost.PublicKey.String()] = len(hostPeerUpdate.Peers) - 1
|
|
|
hostPeerUpdate.HostPeerIDs[peerHost.PublicKey.String()][peer.ID.String()] = models.IDandAddr{
|
|
|
- ID: peer.ID.String(),
|
|
|
- Address: peer.PrimaryAddress(),
|
|
|
- Name: peerHost.Name,
|
|
|
- Network: peer.Network,
|
|
|
+ ID: peer.ID.String(),
|
|
|
+ Address: peer.PrimaryAddress(),
|
|
|
+ Name: peerHost.Name,
|
|
|
+ Network: peer.Network,
|
|
|
+ ProxyListenPort: GetProxyListenPort(peerHost),
|
|
|
}
|
|
|
nodePeer = peerConfig
|
|
|
} else {
|
|
@@ -285,10 +287,11 @@ func GetPeerUpdateForHost(ctx context.Context, network string, host *models.Host
|
|
|
peerAllowedIPs = append(peerAllowedIPs, allowedips...)
|
|
|
hostPeerUpdate.Peers[peerIndexMap[peerHost.PublicKey.String()]].AllowedIPs = peerAllowedIPs
|
|
|
hostPeerUpdate.HostPeerIDs[peerHost.PublicKey.String()][peer.ID.String()] = models.IDandAddr{
|
|
|
- ID: peer.ID.String(),
|
|
|
- Address: peer.PrimaryAddress(),
|
|
|
- Name: peerHost.Name,
|
|
|
- Network: peer.Network,
|
|
|
+ ID: peer.ID.String(),
|
|
|
+ Address: peer.PrimaryAddress(),
|
|
|
+ Name: peerHost.Name,
|
|
|
+ Network: peer.Network,
|
|
|
+ ProxyListenPort: GetProxyListenPort(peerHost),
|
|
|
}
|
|
|
nodePeer = hostPeerUpdate.Peers[peerIndexMap[peerHost.PublicKey.String()]]
|
|
|
}
|
|
@@ -402,6 +405,15 @@ func GetPeerListenPort(host *models.Host) int {
|
|
|
return peerPort
|
|
|
}
|
|
|
|
|
|
+// GetProxyListenPort - fetches the proxy listen port
|
|
|
+func GetProxyListenPort(host *models.Host) int {
|
|
|
+ proxyPort := host.ProxyListenPort
|
|
|
+ if host.PublicListenPort != 0 {
|
|
|
+ proxyPort = host.PublicListenPort
|
|
|
+ }
|
|
|
+ return proxyPort
|
|
|
+}
|
|
|
+
|
|
|
func getExtPeers(node *models.Node) ([]wgtypes.PeerConfig, []models.IDandAddr, error) {
|
|
|
var peers []wgtypes.PeerConfig
|
|
|
var idsAndAddr []models.IDandAddr
|