mirror of
https://github.com/2dust/v2rayN.git
synced 2026-04-24 00:15:57 +00:00
Compare commits
No commits in common. "f500d2b9f4e71c4c24acbb1051fc91e5c5c57a05" and "31de7ec094c8e1c86fd5382b01f5a62e5666ec47" have entirely different histories.
f500d2b9f4
...
31de7ec094
2 changed files with 11 additions and 20 deletions
|
|
@ -2,6 +2,10 @@
|
||||||
{
|
{
|
||||||
public class ProxySettingOSX
|
public class ProxySettingOSX
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
|
* 仅测试了,MacOS 13.7.1 x86 版本,其他版本有待确认
|
||||||
|
*/
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 应用接口类型
|
/// 应用接口类型
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -14,15 +18,13 @@
|
||||||
|
|
||||||
public static async Task SetProxy(string host, int port, string exceptions)
|
public static async Task SetProxy(string host, int port, string exceptions)
|
||||||
{
|
{
|
||||||
var lstInterface = await GetListNetworkServices();
|
var lstCmd = GetSetCmds(host, port, exceptions);
|
||||||
var lstCmd = GetSetCmds(lstInterface, host, port, exceptions);
|
|
||||||
await ExecCmd(lstCmd);
|
await ExecCmd(lstCmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static async Task UnsetProxy()
|
public static async Task UnsetProxy()
|
||||||
{
|
{
|
||||||
var lstInterface = await GetListNetworkServices();
|
var lstCmd = GetUnsetCmds();
|
||||||
var lstCmd = GetUnsetCmds(lstInterface);
|
|
||||||
await ExecCmd(lstCmd);
|
await ExecCmd(lstCmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -40,10 +42,10 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static List<CmdItem> GetSetCmds(List<string> lstInterface, string host, int port, string exceptions)
|
private static List<CmdItem> GetSetCmds(string host, int port, string exceptions)
|
||||||
{
|
{
|
||||||
List<CmdItem> lstCmd = [];
|
List<CmdItem> lstCmd = [];
|
||||||
foreach (var interf in lstInterface)
|
foreach (var interf in LstInterface)
|
||||||
{
|
{
|
||||||
foreach (var type in LstTypes)
|
foreach (var type in LstTypes)
|
||||||
{
|
{
|
||||||
|
|
@ -68,10 +70,10 @@
|
||||||
return lstCmd;
|
return lstCmd;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static List<CmdItem> GetUnsetCmds(List<string> lstInterface)
|
private static List<CmdItem> GetUnsetCmds()
|
||||||
{
|
{
|
||||||
List<CmdItem> lstCmd = [];
|
List<CmdItem> lstCmd = [];
|
||||||
foreach (var interf in lstInterface)
|
foreach (var interf in LstInterface)
|
||||||
{
|
{
|
||||||
foreach (var type in LstTypes)
|
foreach (var type in LstTypes)
|
||||||
{
|
{
|
||||||
|
|
@ -85,16 +87,5 @@
|
||||||
|
|
||||||
return lstCmd;
|
return lstCmd;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static async Task<List<string>> GetListNetworkServices()
|
|
||||||
{
|
|
||||||
var services = await Utils.GetListNetworkServices();
|
|
||||||
if (services.IsNullOrEmpty())
|
|
||||||
{
|
|
||||||
return LstInterface;
|
|
||||||
}
|
|
||||||
var lst = services.Split(Environment.NewLine);
|
|
||||||
return lst.Length > 0 ? LstInterface.Intersect(lst).ToList() : LstInterface;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
<TargetFramework>net8.0</TargetFramework>
|
<TargetFramework>net8.0</TargetFramework>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<Version>7.5.1</Version>
|
<Version>7.5.0</Version>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue