From 48d8a53cd6c36870e23625f00ca3e9161922811e Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Fri, 26 Oct 2018 20:44:51 -0700 Subject: [PATCH] Resolve WAN address using STUN if the PC is discovered over mDNS --- app/backend/computermanager.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/app/backend/computermanager.cpp b/app/backend/computermanager.cpp index 3969bd08..7cf44dea 100644 --- a/app/backend/computermanager.cpp +++ b/app/backend/computermanager.cpp @@ -2,6 +2,9 @@ #include "nvhttp.h" #include "settings/streamingpreferences.h" +#include +#include + #include #include @@ -573,6 +576,12 @@ private: // Update addresses depending on the context if (m_Mdns) { newComputer->localAddress = m_Address; + + // Get the WAN IP address using STUN if we're on mDNS + quint32 addr; + if (LiFindExternalAddressIP4("stun.stunprotocol.org", 3478, &addr) == 0) { + newComputer->remoteAddress = QHostAddress(qFromBigEndian(addr)).toString(); + } } else { newComputer->manualAddress = m_Address;