Add support for IPv6-only hosts

This commit is contained in:
Cameron Gutman 2019-07-15 01:24:39 -07:00
parent 27f0fd63b3
commit a1c659b7b8
2 changed files with 9 additions and 6 deletions

View File

@ -3,6 +3,7 @@ package com.limelight.computers;
import java.io.IOException; import java.io.IOException;
import java.io.OutputStream; import java.io.OutputStream;
import java.io.StringReader; import java.io.StringReader;
import java.net.Inet4Address;
import java.net.InetSocketAddress; import java.net.InetSocketAddress;
import java.net.Socket; import java.net.Socket;
import java.util.HashSet; import java.util.HashSet;
@ -300,16 +301,18 @@ public class ComputerManagerService extends Service {
ComputerDetails details = new ComputerDetails(); ComputerDetails details = new ComputerDetails();
// Populate the computer template with mDNS info // Populate the computer template with mDNS info
if (computer.getAddressV4() != null) { if (computer.getLocalAddress() != null) {
details.localAddress = computer.getAddressV4().getHostAddress(); details.localAddress = computer.getLocalAddress().getHostAddress();
// Since we're on the same network, we can use STUN to find // Since we're on the same network, we can use STUN to find
// our WAN address, which is also very likely the WAN address // our WAN address, which is also very likely the WAN address
// of the PC. We can use this later to connect remotely. // of the PC. We can use this later to connect remotely.
if (computer.getLocalAddress() instanceof Inet4Address) {
details.remoteAddress = NvConnection.findExternalAddressForMdns("stun.moonlight-stream.org", 3478); details.remoteAddress = NvConnection.findExternalAddressForMdns("stun.moonlight-stream.org", 3478);
} }
if (computer.getAddressV6() != null) { }
details.ipv6Address = computer.getAddressV6().getHostAddress(); if (computer.getIpv6Address() != null) {
details.ipv6Address = computer.getIpv6Address().getHostAddress();
} }
// Kick off a serverinfo poll on this machine // Kick off a serverinfo poll on this machine

@ -1 +1 @@
Subproject commit 5872c0bf3de27e8346258119abf341d5cd64d1d8 Subproject commit a279f26b3fa8bb98e14839e55f507d798dfbc530