From 66f0aee3f856fb998d77a70d2461856d3549ecc5 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Sat, 27 Oct 2018 10:46:28 -0700 Subject: [PATCH] Use STUN to discover WAN address when PC is found using mDNS --- .../com/limelight/computers/ComputerManagerService.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/src/main/java/com/limelight/computers/ComputerManagerService.java b/app/src/main/java/com/limelight/computers/ComputerManagerService.java index 0bd8faee..8c4cc5ae 100644 --- a/app/src/main/java/com/limelight/computers/ComputerManagerService.java +++ b/app/src/main/java/com/limelight/computers/ComputerManagerService.java @@ -13,6 +13,7 @@ import java.util.concurrent.atomic.AtomicInteger; import com.limelight.LimeLog; import com.limelight.binding.PlatformBinding; import com.limelight.discovery.DiscoveryService; +import com.limelight.nvstream.NvConnection; import com.limelight.nvstream.http.ComputerDetails; import com.limelight.nvstream.http.NvApp; import com.limelight.nvstream.http.NvHTTP; @@ -344,6 +345,11 @@ public class ComputerManagerService extends Service { else { // mDNS fakeDetails.localAddress = addr; + + // Since we're on the same network, we can use STUN to find + // our WAN address, which is also very likely the WAN address + // of the PC. We can use this later to connect remotely. + fakeDetails.remoteAddress = NvConnection.findExternalAddressForMdns(); } // Block while we try to fill the details