mirror of
https://github.com/BeyondDimension/SteamTools.git
synced 2026-10-25 19:49:43 +08:00
fix macOS Proxy
This commit is contained in:
@@ -5,12 +5,15 @@ namespace System
|
||||
{
|
||||
public static class IPAddress2
|
||||
{
|
||||
public const string _127_0_0_1 = "127.0.0.1";
|
||||
public const string localhost = "localhost";
|
||||
|
||||
public static bool TryParse(
|
||||
[NotNullWhen(true)] string? ipString,
|
||||
[NotNullWhen(true)] out IPAddress? address)
|
||||
{
|
||||
if (ipString == "127.0.0.1" ||
|
||||
string.Equals(ipString, "localhost", StringComparison.OrdinalIgnoreCase))
|
||||
if (ipString == _127_0_0_1 ||
|
||||
string.Equals(ipString, localhost, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
address = IPAddress.Loopback;
|
||||
return true;
|
||||
|
||||
@@ -168,7 +168,8 @@ namespace System.Application.Services
|
||||
httpProxyService.IsWindowsProxy = ProxySettings.EnableWindowsProxy.Value;
|
||||
httpProxyService.IsProxyGOG = ProxySettings.IsProxyGOG.Value;
|
||||
|
||||
httpProxyService.ProxyIp = IPAddress2.TryParse(ProxySettings.SystemProxyIp.Value, out var ip) ? ip : IPAddress.Any;
|
||||
// macOS 上目前因权限问题仅支持 0.0.0.0(IPAddress.Any)
|
||||
httpProxyService.ProxyIp = (!OperatingSystem2.IsMacOS && IPAddress2.TryParse(ProxySettings.SystemProxyIp.Value, out var ip)) ? ip : IPAddress.Any;
|
||||
|
||||
httpProxyService.Socks5ProxyEnable = ProxySettings.Socks5ProxyEnable.Value;
|
||||
httpProxyService.Socks5ProxyPortId = ProxySettings.Socks5ProxyPortId.Value;
|
||||
|
||||
Reference in New Issue
Block a user