mirror of
https://github.com/2dust/v2rayN.git
synced 2025-04-19 21:52:25 +00:00
Compare commits
3 commits
8dcf5c5b90
...
7fbb0013b0
Author | SHA1 | Date | |
---|---|---|---|
![]() |
7fbb0013b0 | ||
![]() |
837cfbd03b | ||
![]() |
cdc5d72cfa |
14 changed files with 57 additions and 53 deletions
|
@ -7,9 +7,9 @@ namespace ServiceLib.Handler
|
|||
private static readonly Lazy<ClashApiHandler> instance = new(() => new());
|
||||
public static ClashApiHandler Instance => instance.Value;
|
||||
|
||||
private static readonly string _tag = "ClashApiHandler";
|
||||
private Dictionary<string, ProxiesItem>? _proxies;
|
||||
public Dictionary<string, object> ProfileContent { get; set; }
|
||||
private static readonly string _tag = "ClashApiHandler";
|
||||
|
||||
public async Task<Tuple<ClashProxies, ClashProviders>?> GetClashProxiesAsync(Config config)
|
||||
{
|
||||
|
@ -54,7 +54,7 @@ namespace ServiceLib.Handler
|
|||
return;
|
||||
}
|
||||
lstProxy = new List<ClashProxyModel>();
|
||||
foreach (KeyValuePair<string, ProxiesItem> kv in _proxies)
|
||||
foreach (var kv in _proxies)
|
||||
{
|
||||
if (Global.notAllowTestType.Contains(kv.Value.type.ToLower()))
|
||||
{
|
||||
|
|
|
@ -26,7 +26,7 @@ namespace ServiceLib.Handler
|
|||
//Execute once 20 minute
|
||||
if (numOfExecuted % 20 == 0)
|
||||
{
|
||||
Logging.SaveLog("Execute save config");
|
||||
//Logging.SaveLog("Execute save config");
|
||||
|
||||
await ConfigHandler.SaveConfig(config);
|
||||
await ProfileExHandler.Instance.SaveTo();
|
||||
|
@ -35,7 +35,7 @@ namespace ServiceLib.Handler
|
|||
//Execute once 1 hour
|
||||
if (numOfExecuted % 60 == 0)
|
||||
{
|
||||
Logging.SaveLog("Execute delete expired files");
|
||||
//Logging.SaveLog("Execute delete expired files");
|
||||
|
||||
FileManager.DeleteExpiredFiles(Utils.GetBinConfigPath(), DateTime.Now.AddHours(-1));
|
||||
FileManager.DeleteExpiredFiles(Utils.GetLogPath(), DateTime.Now.AddMonths(-1));
|
||||
|
@ -72,7 +72,7 @@ namespace ServiceLib.Handler
|
|||
updateFunc?.Invoke(success, msg);
|
||||
if (success)
|
||||
{
|
||||
Logging.SaveLog("Update subscription end" + msg);
|
||||
Logging.SaveLog($"Update subscription end. {msg}");
|
||||
}
|
||||
});
|
||||
item.UpdateTime = updateTime;
|
||||
|
|
2
v2rayN/ServiceLib/Resx/ResUI.Designer.cs
generated
2
v2rayN/ServiceLib/Resx/ResUI.Designer.cs
generated
|
@ -2483,7 +2483,7 @@ namespace ServiceLib.Resx {
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 Address(Ip,Ipv6) 的本地化字符串。
|
||||
/// 查找类似 Address(Ipv4,Ipv6) 的本地化字符串。
|
||||
/// </summary>
|
||||
public static string TbLocalAddress {
|
||||
get {
|
||||
|
|
|
@ -1319,7 +1319,7 @@
|
|||
<value>Previous proxy remarks</value>
|
||||
</data>
|
||||
<data name="TbLocalAddress" xml:space="preserve">
|
||||
<value>آدرس (IP, IPv6)</value>
|
||||
<value>آدرس (IPv4, IPv6)</value>
|
||||
</data>
|
||||
<data name="TbReserved" xml:space="preserve">
|
||||
<value>Reserved(2,3,4)</value>
|
||||
|
|
|
@ -1100,7 +1100,7 @@
|
|||
<value>Fenntartva (2,3,4)</value>
|
||||
</data>
|
||||
<data name="TbLocalAddress" xml:space="preserve">
|
||||
<value>Cím (Ip,Ipv6)</value>
|
||||
<value>Cím (Ipv4,Ipv6)</value>
|
||||
</data>
|
||||
<data name="TbPath7" xml:space="preserve">
|
||||
<value>obfs jelszó</value>
|
||||
|
|
|
@ -1100,7 +1100,7 @@
|
|||
<value>Reserved(2,3,4)</value>
|
||||
</data>
|
||||
<data name="TbLocalAddress" xml:space="preserve">
|
||||
<value>Address(Ip,Ipv6)</value>
|
||||
<value>Address(Ipv4,Ipv6)</value>
|
||||
</data>
|
||||
<data name="TbPath7" xml:space="preserve">
|
||||
<value>obfs password</value>
|
||||
|
@ -1402,4 +1402,4 @@
|
|||
<data name="TbPorts7Tips" xml:space="preserve">
|
||||
<value>Will cover the port, separate with commas (,)</value>
|
||||
</data>
|
||||
</root>
|
||||
</root>
|
||||
|
|
|
@ -1052,7 +1052,7 @@
|
|||
<value>obfs password</value>
|
||||
</data>
|
||||
<data name="TbLocalAddress" xml:space="preserve">
|
||||
<value>Address(Ip,Ipv6)</value>
|
||||
<value>Address(Ipv4,Ipv6)</value>
|
||||
</data>
|
||||
<data name="TbSettingsDomainStrategy4Out" xml:space="preserve">
|
||||
<value>Default domain strategy for outbound</value>
|
||||
|
|
|
@ -1097,7 +1097,7 @@
|
|||
<value>Reserved(2,3,4)</value>
|
||||
</data>
|
||||
<data name="TbLocalAddress" xml:space="preserve">
|
||||
<value>Address(Ip,Ipv6)</value>
|
||||
<value>Address(Ipv4,Ipv6)</value>
|
||||
</data>
|
||||
<data name="TbPath7" xml:space="preserve">
|
||||
<value>混淆密码(obfs password)</value>
|
||||
|
|
|
@ -1326,7 +1326,7 @@
|
|||
<value>Reserved(2,3,4)</value>
|
||||
</data>
|
||||
<data name="TbLocalAddress" xml:space="preserve">
|
||||
<value>Address(Ip,Ipv6)</value>
|
||||
<value>Address(Ipv4,Ipv6)</value>
|
||||
</data>
|
||||
<data name="TbSettingsUseSystemHosts" xml:space="preserve">
|
||||
<value>使用系統hosts</value>
|
||||
|
|
|
@ -733,15 +733,10 @@ namespace ServiceLib.Services.CoreConfig
|
|||
if (node.Ports.IsNotEmpty())
|
||||
{
|
||||
outbound.server_port = null;
|
||||
outbound.server_ports = new List<string>();
|
||||
var ports = node.Ports.Split(',')
|
||||
.Select(p => p.Trim())
|
||||
.Where(p => !string.IsNullOrEmpty(p))
|
||||
outbound.server_ports = node.Ports.Split(',')
|
||||
.Where(p => p.Trim().IsNotEmpty())
|
||||
.Select(p => p.Replace('-', ':'))
|
||||
.ToList();
|
||||
foreach (var it in ports)
|
||||
{
|
||||
outbound.server_ports.Add(it.Contains('-') ? it.Replace('-', ':') : it);
|
||||
}
|
||||
outbound.hop_interval = _config.HysteriaItem.HopInterval > 0 ? $"{_config.HysteriaItem.HopInterval}s" : null;
|
||||
}
|
||||
|
||||
|
|
|
@ -53,26 +53,31 @@ namespace ServiceLib.ViewModels
|
|||
|
||||
private async Task Init()
|
||||
{
|
||||
var lastTime = DateTime.Now;
|
||||
Task.Run(async () =>
|
||||
{
|
||||
var numOfExecuted = 1;
|
||||
while (true)
|
||||
{
|
||||
await Task.Delay(1000 * 5);
|
||||
numOfExecuted++;
|
||||
if (!(AutoRefresh && _config.UiItem.ShowInTaskbar && _config.IsRunningCore(ECoreType.sing_box)))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (_config.ClashUIItem.ConnectionsRefreshInterval <= 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (numOfExecuted % _config.ClashUIItem.ConnectionsRefreshInterval != 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
await GetClashConnections();
|
||||
}
|
||||
});
|
||||
|
||||
Observable.Interval(TimeSpan.FromSeconds(5))
|
||||
.Subscribe(async x =>
|
||||
{
|
||||
if (!(AutoRefresh && _config.UiItem.ShowInTaskbar && _config.IsRunningCore(ECoreType.sing_box)))
|
||||
{
|
||||
return;
|
||||
}
|
||||
var dtNow = DateTime.Now;
|
||||
if (_config.ClashUIItem.ConnectionsRefreshInterval > 0)
|
||||
{
|
||||
if ((dtNow - lastTime).Minutes % _config.ClashUIItem.ConnectionsRefreshInterval == 0)
|
||||
{
|
||||
await GetClashConnections();
|
||||
lastTime = dtNow;
|
||||
}
|
||||
Task.Delay(1000).Wait();
|
||||
}
|
||||
});
|
||||
await Task.CompletedTask;
|
||||
}
|
||||
|
||||
|
|
|
@ -95,8 +95,8 @@ namespace ServiceLib.ViewModels
|
|||
|
||||
private async Task Init()
|
||||
{
|
||||
await ProxiesReload();
|
||||
_ = DelayTestTask();
|
||||
await ProxiesReload();
|
||||
}
|
||||
|
||||
private async Task DoRulemodeSelected(bool c)
|
||||
|
@ -383,8 +383,6 @@ namespace ServiceLib.ViewModels
|
|||
|
||||
private async Task ProxiesDelayTest(bool blAll)
|
||||
{
|
||||
//UpdateHandler(false, "Clash Proxies Latency Test");
|
||||
|
||||
ClashApiHandler.Instance.ClashProxiesDelayTest(blAll, _proxyDetails.ToList(), async (item, result) =>
|
||||
{
|
||||
if (item == null)
|
||||
|
@ -434,13 +432,13 @@ namespace ServiceLib.ViewModels
|
|||
|
||||
public async Task DelayTestTask()
|
||||
{
|
||||
var lastTime = DateTime.Now;
|
||||
_ = Task.Run(async () =>
|
||||
Task.Run(async () =>
|
||||
{
|
||||
var numOfExecuted = 1;
|
||||
while (true)
|
||||
{
|
||||
await Task.Delay(1000 * 60);
|
||||
|
||||
numOfExecuted++;
|
||||
if (!(AutoRefresh && _config.UiItem.ShowInTaskbar && _config.IsRunningCore(ECoreType.sing_box)))
|
||||
{
|
||||
continue;
|
||||
|
@ -449,13 +447,11 @@ namespace ServiceLib.ViewModels
|
|||
{
|
||||
continue;
|
||||
}
|
||||
var dtNow = DateTime.Now;
|
||||
if ((dtNow - lastTime).Minutes % _config.ClashUIItem.ProxiesAutoDelayTestInterval != 0)
|
||||
if (numOfExecuted % _config.ClashUIItem.ProxiesAutoDelayTestInterval != 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
await ProxiesDelayTest();
|
||||
lastTime = dtNow;
|
||||
}
|
||||
});
|
||||
await Task.CompletedTask;
|
||||
|
|
|
@ -349,7 +349,8 @@
|
|||
Grid.Row="3"
|
||||
Grid.Column="1"
|
||||
Width="400"
|
||||
Margin="{StaticResource Margin4}" />
|
||||
Margin="{StaticResource Margin4}"
|
||||
Watermark="1000:2000,3000:4000" />
|
||||
<TextBlock
|
||||
Grid.Row="3"
|
||||
Grid.Column="2"
|
||||
|
@ -448,7 +449,8 @@
|
|||
Grid.Row="3"
|
||||
Grid.Column="1"
|
||||
Width="400"
|
||||
Margin="{StaticResource Margin4}" />
|
||||
Margin="{StaticResource Margin4}"
|
||||
Watermark="2,3,4" />
|
||||
|
||||
<TextBlock
|
||||
Grid.Row="4"
|
||||
|
@ -461,7 +463,8 @@
|
|||
Grid.Row="4"
|
||||
Grid.Column="1"
|
||||
Width="400"
|
||||
Margin="{StaticResource Margin4}" />
|
||||
Margin="{StaticResource Margin4}"
|
||||
Watermark="Ipv4,Ipv6" />
|
||||
|
||||
<TextBlock
|
||||
Grid.Row="5"
|
||||
|
@ -475,7 +478,8 @@
|
|||
Grid.Column="1"
|
||||
Width="200"
|
||||
Margin="{StaticResource Margin4}"
|
||||
HorizontalAlignment="Left" />
|
||||
HorizontalAlignment="Left"
|
||||
Watermark="1500" />
|
||||
</Grid>
|
||||
|
||||
<Separator
|
||||
|
|
|
@ -479,6 +479,7 @@
|
|||
Width="400"
|
||||
Margin="{StaticResource Margin4}"
|
||||
HorizontalAlignment="Left"
|
||||
materialDesign:HintAssist.Hint="1000:2000,3000:4000"
|
||||
Style="{StaticResource DefTextBox}" />
|
||||
<TextBlock
|
||||
Grid.Row="3"
|
||||
|
@ -609,6 +610,7 @@
|
|||
Grid.Column="1"
|
||||
Width="400"
|
||||
Margin="{StaticResource Margin4}"
|
||||
materialDesign:HintAssist.Hint="2,3,4"
|
||||
Style="{StaticResource DefTextBox}" />
|
||||
|
||||
<TextBlock
|
||||
|
@ -624,6 +626,7 @@
|
|||
Grid.Column="1"
|
||||
Width="400"
|
||||
Margin="{StaticResource Margin4}"
|
||||
materialDesign:HintAssist.Hint="Ipv4,Ipv6"
|
||||
Style="{StaticResource DefTextBox}" />
|
||||
|
||||
<TextBlock
|
||||
|
@ -640,6 +643,7 @@
|
|||
Width="200"
|
||||
Margin="{StaticResource Margin4}"
|
||||
HorizontalAlignment="Left"
|
||||
materialDesign:HintAssist.Hint="1500"
|
||||
Style="{StaticResource DefTextBox}" />
|
||||
</Grid>
|
||||
|
||||
|
|
Loading…
Reference in a new issue