Add registry settings system proxy

This commit is contained in:
2dust 2023-04-25 10:56:07 +08:00
parent f747416d3b
commit b9beb4be9d
4 changed files with 8 additions and 18 deletions

View file

@ -4,7 +4,6 @@ using System.Net;
using System.Net.Http; using System.Net.Http;
using System.Net.Http.Headers; using System.Net.Http.Headers;
using System.Net.Sockets; using System.Net.Sockets;
using System.Threading;
using v2rayN.Base; using v2rayN.Base;
using v2rayN.Resx; using v2rayN.Resx;

View file

@ -79,10 +79,12 @@ namespace v2rayN.Handler
.Replace("{http_port}", port.ToString()) .Replace("{http_port}", port.ToString())
.Replace("{socks_port}", portSocks.ToString()); .Replace("{socks_port}", portSocks.ToString());
} }
ProxySetting.SetProxy(strProxy, strExceptions, 2);
SetIEProxy(true, strProxy, strExceptions); SetIEProxy(true, strProxy, strExceptions);
} }
else if (type == ESysProxyType.ForcedClear) else if (type == ESysProxyType.ForcedClear)
{ {
ProxySetting.UnsetProxy();
ResetIEProxy(); ResetIEProxy();
} }
else if (type == ESysProxyType.Unchanged) else if (type == ESysProxyType.Unchanged)
@ -92,6 +94,7 @@ namespace v2rayN.Handler
{ {
PacHandler.Start(Utils.GetConfigPath(), port, portPac); PacHandler.Start(Utils.GetConfigPath(), port, portPac);
var strProxy = $"{Global.httpProtocol}{Global.Loopback}:{portPac}/pac?t={DateTime.Now.Ticks}"; var strProxy = $"{Global.httpProtocol}{Global.Loopback}:{portPac}/pac?t={DateTime.Now.Ticks}";
ProxySetting.SetProxy(strProxy, "", 4);
SetIEProxy(false, strProxy, ""); SetIEProxy(false, strProxy, "");
} }
@ -129,22 +132,9 @@ namespace v2rayN.Handler
} }
// set system proxy to 1 (null) (null) (null) // set system proxy to 1 (null) (null) (null)
public static bool ResetIEProxy() public static void ResetIEProxy()
{ {
try ExecSysproxy("set 1 - - -");
{
// clear user-wininet.json
//_userSettings = new SysproxyConfig();
//Save();
// clear system setting
ExecSysproxy("set 1 - - -");
}
catch (Exception)
{
return false;
}
return true;
} }
private static void ExecSysproxy(string arguments) private static void ExecSysproxy(string arguments)

View file

@ -109,7 +109,7 @@
public List<string> alpn { get; set; } public List<string> alpn { get; set; }
public Utls4Sbox utls { get; set; } public Utls4Sbox utls { get; set; }
public Reality4Sbox reality { get; set; } public Reality4Sbox reality { get; set; }
} }
public class Multiplex4Sbox public class Multiplex4Sbox
{ {
@ -152,7 +152,7 @@
public string strategy { get; set; } public string strategy { get; set; }
public string detour { get; set; } public string detour { get; set; }
} }
public class Experimental4Sbox public class Experimental4Sbox
{ {
public V2ray_Api4Sbox v2ray_api { get; set; } public V2ray_Api4Sbox v2ray_api { get; set; }

View file

@ -693,6 +693,7 @@
Grid.Column="1" Grid.Column="1"
Width="300" Width="300"
Margin="{StaticResource SettingItemMargin}" Margin="{StaticResource SettingItemMargin}"
IsEditable="True"
Style="{StaticResource DefComboBox}" /> Style="{StaticResource DefComboBox}" />
<TextBlock <TextBlock