From 4681b916eb56feeeb5696bebb359850beec99006 Mon Sep 17 00:00:00 2001 From: UnfamiliarLegacy <74633542+UnfamiliarLegacy@users.noreply.github.com> Date: Fri, 26 Nov 2021 20:25:12 +0100 Subject: [PATCH] Add ignored hosts for proxy --- .../connection/proxy/nitro/os/windows/NitroWindows.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/G-Earth/src/main/java/gearth/protocol/connection/proxy/nitro/os/windows/NitroWindows.java b/G-Earth/src/main/java/gearth/protocol/connection/proxy/nitro/os/windows/NitroWindows.java index fc5abf5..049a6be 100644 --- a/G-Earth/src/main/java/gearth/protocol/connection/proxy/nitro/os/windows/NitroWindows.java +++ b/G-Earth/src/main/java/gearth/protocol/connection/proxy/nitro/os/windows/NitroWindows.java @@ -12,6 +12,11 @@ import java.io.IOException; public class NitroWindows implements NitroOsFunctions { + /** + * Semicolon separated hosts to ignore for proxying. + */ + private static final String PROXY_IGNORE = "discord.com;github.com;"; + /** * Checks if the certificate is trusted by the local machine. * @param certificate Absolute path to the certificate. @@ -59,6 +64,7 @@ public class NitroWindows implements NitroOsFunctions { try { final String proxy = String.format("%s:%d", host, port); Runtime.getRuntime().exec("reg add \"HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\" /v ProxyServer /t REG_SZ /d \"" + proxy + "\" /f"); + Runtime.getRuntime().exec("reg add \"HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\" /v ProxyOverride /t REG_SZ /d \"" + PROXY_IGNORE + "\" /f"); Runtime.getRuntime().exec("reg add \"HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\" /v ProxyEnable /t REG_DWORD /d 1 /f"); return true; } catch (Exception e) {