Utils::Platform: Fix minor ip recognition bug

This commit is contained in:
tt2468 2021-06-06 00:02:59 -07:00
parent d3c7f4b3fd
commit ed79da92e0

View File

@ -35,9 +35,9 @@ std::string Utils::Platform::GetLocalAddress()
std::vector<std::pair<QString, uint8_t>> preferredAddresses;
for (auto address : validAddresses) {
// Attribute a priority (0 is best) to the address to choose the best picks
if (address.startsWith("192.168.1") || address.startsWith("192.168.0")) { // Prefer common consumer router network prefixes
if (address.startsWith("192.168.1.") || address.startsWith("192.168.0.")) { // Prefer common consumer router network prefixes
preferredAddresses.push_back(std::make_pair(address, 0));
} else if (address.startsWith("172.16")) { // Slightly less common consumer router network prefixes
} else if (address.startsWith("172.16.")) { // Slightly less common consumer router network prefixes
preferredAddresses.push_back(std::make_pair(address, 1));
} else if (address.startsWith("10.")) { // Even less common consumer router network prefixes
preferredAddresses.push_back(std::make_pair(address, 2));