diff --git a/G-Earth/src/main/java/gearth/protocol/connection/proxy/ProxyProviderFactory.java b/G-Earth/src/main/java/gearth/protocol/connection/proxy/ProxyProviderFactory.java index 71d04fd..806f488 100644 --- a/G-Earth/src/main/java/gearth/protocol/connection/proxy/ProxyProviderFactory.java +++ b/G-Earth/src/main/java/gearth/protocol/connection/proxy/ProxyProviderFactory.java @@ -27,7 +27,10 @@ public class ProxyProviderFactory { public static final String HOTELS_CACHE_KEY = "hotelsConnectionInfo"; private static SocksConfiguration socksConfig = null; - public static List autoDetectHosts; + private static List autoDetectHosts; + private static List autoDetectHostsOrigins; + private static List allHosts; + static { autoDetectHosts = new ArrayList<>(); autoDetectHosts.add("game-br.habbo.com:30000"); @@ -41,10 +44,15 @@ public class ProxyProviderFactory { autoDetectHosts.add("game-us.habbo.com:30000"); autoDetectHosts.add("game-s2.habbo.com:30000"); - autoDetectHosts.add("game-od.habbo.com:40001"); - autoDetectHosts.add("game-ous.habbo.com:40001"); - autoDetectHosts.add("game-obr.habbo.com:40001"); - autoDetectHosts.add("game-oes.habbo.com:40001"); + autoDetectHostsOrigins = new ArrayList<>(); + autoDetectHostsOrigins.add("game-od.habbo.com:40001"); + autoDetectHostsOrigins.add("game-ous.habbo.com:40001"); + autoDetectHostsOrigins.add("game-obr.habbo.com:40001"); + autoDetectHostsOrigins.add("game-oes.habbo.com:40001"); + + allHosts = new ArrayList<>(autoDetectHosts.size() + autoDetectHostsOrigins.size()); + allHosts.addAll(autoDetectHosts); + allHosts.addAll(autoDetectHostsOrigins); List additionalCachedHotels = Cacher.getList(HOTELS_CACHE_KEY); if (additionalCachedHotels != null) { @@ -56,7 +64,7 @@ public class ProxyProviderFactory { } if (OSValidator.isMac()) { - for (int i = 2; i <= autoDetectHosts.size() + 5; i++) { + for (int i = 2; i <= allHosts.size() + 5; i++) { ProcessBuilder allowLocalHost = new ProcessBuilder("ifconfig", "lo0", "alias", ("127.0.0." + i), "up"); try { allowLocalHost.start(); @@ -67,6 +75,10 @@ public class ProxyProviderFactory { } } + public static List getAllHosts() { + return allHosts; + } + private final HProxySetter proxySetter; private final HStateSetter stateSetter; private final HConnection hConnection; @@ -89,7 +101,7 @@ public class ProxyProviderFactory { } public ProxyProvider provide(HClient client) { - return provide(client, autoDetectHosts); + return provide(client, client == HClient.FLASH ? autoDetectHosts : autoDetectHostsOrigins); } public ProxyProvider provide(HClient client, String domain, int port) { diff --git a/G-Earth/src/main/java/gearth/ui/subforms/connection/ConnectionController.java b/G-Earth/src/main/java/gearth/ui/subforms/connection/ConnectionController.java index f05ffe5..2ec0da3 100644 --- a/G-Earth/src/main/java/gearth/ui/subforms/connection/ConnectionController.java +++ b/G-Earth/src/main/java/gearth/ui/subforms/connection/ConnectionController.java @@ -96,7 +96,7 @@ public class ConnectionController extends SubForm { updateInputUI(); }); - List knownHosts = ProxyProviderFactory.autoDetectHosts; + List knownHosts = ProxyProviderFactory.getAllHosts(); Set hosts = new HashSet<>(); Set ports = new HashSet<>();