Update On Wed Apr 2 20:37:26 CEST 2025

This commit is contained in:
github-action[bot]
2025-04-02 20:37:26 +02:00
parent 2ca4683e7a
commit 9101e52e34
239 changed files with 24256 additions and 24315 deletions
@@ -1,33 +1,32 @@
namespace ServiceLib.Handler.SysProxy
namespace ServiceLib.Handler.SysProxy;
public class ProxySettingLinux
{
public class ProxySettingLinux
private static readonly string _proxySetFileName = $"{Global.ProxySetLinuxShellFileName.Replace(Global.NamespaceSample, "")}.sh";
public static async Task SetProxy(string host, int port, string exceptions)
{
private static readonly string _proxySetFileName = $"{Global.ProxySetLinuxShellFileName.Replace(Global.NamespaceSample, "")}.sh";
List<string> args = ["manual", host, port.ToString(), exceptions];
await ExecCmd(args);
}
public static async Task SetProxy(string host, int port, string exceptions)
public static async Task UnsetProxy()
{
List<string> args = ["none"];
await ExecCmd(args);
}
private static async Task ExecCmd(List<string> args)
{
var fileName = Utils.GetBinConfigPath(_proxySetFileName);
if (!File.Exists(fileName))
{
List<string> args = ["manual", host, port.ToString(), exceptions];
await ExecCmd(args);
var contents = EmbedUtils.GetEmbedText(Global.ProxySetLinuxShellFileName);
await File.AppendAllTextAsync(fileName, contents);
await Utils.SetLinuxChmod(fileName);
}
public static async Task UnsetProxy()
{
List<string> args = ["none"];
await ExecCmd(args);
}
private static async Task ExecCmd(List<string> args)
{
var fileName = Utils.GetBinConfigPath(_proxySetFileName);
if (!File.Exists(fileName))
{
var contents = EmbedUtils.GetEmbedText(Global.ProxySetLinuxShellFileName);
await File.AppendAllTextAsync(fileName, contents);
await Utils.SetLinuxChmod(fileName);
}
await Utils.GetCliWrapOutput(fileName, args);
}
await Utils.GetCliWrapOutput(fileName, args);
}
}