Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d59e59ca40 | ||
|
|
c9a278b4a2 | ||
|
|
8ee5304148 | ||
|
|
3beaa8145f |
@@ -23,7 +23,7 @@ namespace v2rayN
|
||||
public const string SpeedPingTestUrl = @"https://www.google.com/generate_204";
|
||||
public const string JuicityCoreUrl = "https://github.com/juicity/juicity/releases";
|
||||
public const string CustomRoutingListUrl = @"https://raw.githubusercontent.com/2dust/v2rayCustomRoutingList/master/";
|
||||
public const string SingboxRulesetUrlGeosite = @"https://raw.githubusercontent.com/SagerNet/sing-geosite/rule-set/geosite-{0}.srs";
|
||||
public const string SingboxRulesetUrlGeosite = @"https://raw.githubusercontent.com/SagerNet/sing-geosite/rule-set/{0}.srs";
|
||||
public const string SingboxRulesetUrlGeoip = @"https://raw.githubusercontent.com/Loyalsoldier/geoip/release/srs/{0}.srs";
|
||||
|
||||
public const string PromotionUrl = @"aHR0cHM6Ly85LjIzNDQ1Ni54eXovYWJjLmh0bWw=";
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Net;
|
||||
using System.Data;
|
||||
using System.Net;
|
||||
using System.Net.NetworkInformation;
|
||||
using v2rayN.Enums;
|
||||
using v2rayN.Models;
|
||||
@@ -889,6 +890,10 @@ namespace v2rayN.Handler.CoreConfig
|
||||
|
||||
private int ConvertGeo2Ruleset(SingboxConfig singboxConfig)
|
||||
{
|
||||
static void AddRuleSets(List<string> ruleSets, List<string>? rule_set)
|
||||
{
|
||||
if (rule_set != null) ruleSets.AddRange(rule_set);
|
||||
}
|
||||
var geosite = "geosite";
|
||||
var geoip = "geoip";
|
||||
var ruleSets = new List<string>();
|
||||
@@ -898,13 +903,13 @@ namespace v2rayN.Handler.CoreConfig
|
||||
{
|
||||
rule.rule_set = rule?.geosite?.Select(t => $"{geosite}-{t}").ToList();
|
||||
rule.geosite = null;
|
||||
ruleSets.AddRange(rule.rule_set);
|
||||
AddRuleSets(ruleSets, rule.rule_set);
|
||||
}
|
||||
foreach (var rule in singboxConfig.route.rules.Where(t => t.geoip?.Count > 0).ToList() ?? [])
|
||||
{
|
||||
rule.rule_set = rule?.geoip?.Select(t => $"{geoip}-{t}").ToList();
|
||||
rule.geoip = null;
|
||||
ruleSets.AddRange(rule.rule_set);
|
||||
AddRuleSets(ruleSets, rule.rule_set);
|
||||
}
|
||||
|
||||
//convert dns geosite & geoip to ruleset
|
||||
@@ -920,7 +925,15 @@ namespace v2rayN.Handler.CoreConfig
|
||||
}
|
||||
foreach (var dnsRule in singboxConfig.dns?.rules.Where(t => t.rule_set?.Count > 0).ToList() ?? [])
|
||||
{
|
||||
ruleSets.AddRange(dnsRule.rule_set);
|
||||
AddRuleSets(ruleSets, dnsRule.rule_set);
|
||||
}
|
||||
//rules in rules
|
||||
foreach (var item in singboxConfig.dns?.rules.Where(t => t.rules?.Count > 0).Select(t => t.rules).ToList() ?? [])
|
||||
{
|
||||
foreach (var item2 in item ?? [])
|
||||
{
|
||||
AddRuleSets(ruleSets, item2.rule_set);
|
||||
}
|
||||
}
|
||||
|
||||
//load custom ruleset file
|
||||
@@ -946,6 +959,7 @@ namespace v2rayN.Handler.CoreConfig
|
||||
singboxConfig.route.rule_set = [];
|
||||
foreach (var item in new HashSet<string>(ruleSets))
|
||||
{
|
||||
if (Utils.IsNullOrEmpty(item)) { continue; }
|
||||
var customRuleset = customRulesets.FirstOrDefault(t => t.tag != null && t.tag.Equals(item));
|
||||
if (customRuleset != null)
|
||||
{
|
||||
@@ -953,14 +967,14 @@ namespace v2rayN.Handler.CoreConfig
|
||||
}
|
||||
else
|
||||
{
|
||||
var geo = item.Split('-').FirstOrDefault() ?? geosite;
|
||||
var value = item.Split('-').LastOrDefault();
|
||||
singboxConfig.route.rule_set.Add(new()
|
||||
{
|
||||
type = "remote",
|
||||
format = "binary",
|
||||
tag = item,
|
||||
url = string.Format(geo.Equals(geosite) ? Global.SingboxRulesetUrlGeosite : Global.SingboxRulesetUrlGeoip, value),
|
||||
url = item.StartsWith(geosite) ?
|
||||
string.Format(Global.SingboxRulesetUrlGeosite, item) :
|
||||
string.Format(Global.SingboxRulesetUrlGeoip, item.Replace($"{geoip}-", "")),
|
||||
download_detour = Global.ProxyTag
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Reactive.Linq;
|
||||
using System.Text;
|
||||
using v2rayN.Enums;
|
||||
using v2rayN.Handler.CoreConfig;
|
||||
|
||||
@@ -336,7 +336,11 @@ namespace v2rayN.Handler
|
||||
arguments = "-f config.json",
|
||||
coreUrl = Global.MihomoCoreUrl,
|
||||
coreReleaseApiUrl = Global.MihomoCoreUrl.Replace(Global.GithubUrl, Global.GithubApiUrl),
|
||||
coreDownloadUrl32 = Global.ClashMetaCoreUrl + "/download/{0}/mihomo-windows-386-{0}.zip",
|
||||
coreDownloadUrl64 = Global.ClashMetaCoreUrl + "/download/{0}/mihomo-windows-amd64-compatible-{0}.zip",
|
||||
coreDownloadUrlArm64 = Global.ClashMetaCoreUrl + "/download/{0}/mihomo-windows-arm64-{0}.zip",
|
||||
match = "Mihomo",
|
||||
versionArg = "-v",
|
||||
redirectInfo = true,
|
||||
});
|
||||
|
||||
|
||||
@@ -49,6 +49,7 @@
|
||||
public string? mode { get; set; }
|
||||
public bool? ip_is_private { get; set; }
|
||||
public string? client_subnet { get; set; }
|
||||
public bool? invert { get; set; }
|
||||
public List<string>? inbound { get; set; }
|
||||
public List<string>? protocol { get; set; }
|
||||
public List<string>? network { get; set; }
|
||||
|
||||
@@ -150,18 +150,10 @@ namespace v2rayN.ViewModels
|
||||
|
||||
//CheckUpdate
|
||||
public ReactiveCommand<Unit, Unit> CheckUpdateNCmd { get; }
|
||||
|
||||
//public ReactiveCommand<Unit, Unit> CheckUpdateV2flyCoreCmd { get; }
|
||||
|
||||
//public ReactiveCommand<Unit, Unit> CheckUpdateSagerNetCoreCmd { get; }
|
||||
public ReactiveCommand<Unit, Unit> CheckUpdateXrayCoreCmd { get; }
|
||||
|
||||
//public ReactiveCommand<Unit, Unit> CheckUpdateClashCoreCmd { get; }
|
||||
//public ReactiveCommand<Unit, Unit> CheckUpdateClashMetaCoreCmd { get; }
|
||||
public ReactiveCommand<Unit, Unit> CheckUpdateClashMetaCoreCmd { get; }
|
||||
public ReactiveCommand<Unit, Unit> CheckUpdateSingBoxCoreCmd { get; }
|
||||
|
||||
public ReactiveCommand<Unit, Unit> CheckUpdateGeoCmd { get; }
|
||||
|
||||
public ReactiveCommand<Unit, Unit> ReloadCmd { get; }
|
||||
|
||||
[Reactive]
|
||||
@@ -520,29 +512,17 @@ namespace v2rayN.ViewModels
|
||||
{
|
||||
CheckUpdateN();
|
||||
});
|
||||
//CheckUpdateV2flyCoreCmd = ReactiveCommand.Create(() =>
|
||||
//{
|
||||
// CheckUpdateCore(ECoreType.v2fly_v5);
|
||||
//});
|
||||
//CheckUpdateSagerNetCoreCmd = ReactiveCommand.Create(() =>
|
||||
//{
|
||||
// CheckUpdateCore(ECoreType.SagerNet);
|
||||
//});
|
||||
CheckUpdateXrayCoreCmd = ReactiveCommand.Create(() =>
|
||||
{
|
||||
CheckUpdateCore(ECoreType.Xray);
|
||||
CheckUpdateCore(ECoreType.Xray, null);
|
||||
});
|
||||
CheckUpdateClashMetaCoreCmd = ReactiveCommand.Create(() =>
|
||||
{
|
||||
CheckUpdateCore(ECoreType.mihomo, false);
|
||||
});
|
||||
//CheckUpdateClashCoreCmd = ReactiveCommand.Create(() =>
|
||||
//{
|
||||
// CheckUpdateCore(ECoreType.clash);
|
||||
//});
|
||||
//CheckUpdateClashMetaCoreCmd = ReactiveCommand.Create(() =>
|
||||
//{
|
||||
// CheckUpdateCore(ECoreType.clash_meta);
|
||||
//});
|
||||
CheckUpdateSingBoxCoreCmd = ReactiveCommand.Create(() =>
|
||||
{
|
||||
CheckUpdateCore(ECoreType.sing_box);
|
||||
CheckUpdateCore(ECoreType.sing_box, null);
|
||||
});
|
||||
CheckUpdateGeoCmd = ReactiveCommand.Create(() =>
|
||||
{
|
||||
@@ -1473,7 +1453,7 @@ namespace v2rayN.ViewModels
|
||||
(new UpdateHandle()).CheckUpdateGuiN(_config, _updateUI, _config.guiItem.checkPreReleaseUpdate);
|
||||
}
|
||||
|
||||
private void CheckUpdateCore(ECoreType type)
|
||||
private void CheckUpdateCore(ECoreType type, bool? preRelease)
|
||||
{
|
||||
void _updateUI(bool success, string msg)
|
||||
{
|
||||
@@ -1499,7 +1479,7 @@ namespace v2rayN.ViewModels
|
||||
}
|
||||
}
|
||||
}
|
||||
(new UpdateHandle()).CheckUpdateCore(type, _config, _updateUI, _config.guiItem.checkPreReleaseUpdate);
|
||||
(new UpdateHandle()).CheckUpdateCore(type, _config, _updateUI, preRelease ?? _config.guiItem.checkPreReleaseUpdate);
|
||||
}
|
||||
|
||||
private void CheckUpdateGeo()
|
||||
|
||||
@@ -37,8 +37,8 @@
|
||||
</Window.Resources>
|
||||
|
||||
<materialDesign:DialogHost
|
||||
Identifier="RootDialog"
|
||||
materialDesign:TransitionAssist.DisableTransitions="True"
|
||||
Identifier="RootDialog"
|
||||
SnackbarMessageQueue="{Binding ElementName=MainSnackbar, Path=MessageQueue}"
|
||||
Style="{StaticResource MaterialDesignEmbeddedDialogHost}">
|
||||
<Grid>
|
||||
@@ -231,28 +231,14 @@
|
||||
x:Name="menuCheckUpdateN"
|
||||
Height="{StaticResource MenuItemHeight}"
|
||||
Header="V2rayN" />
|
||||
<!--<MenuItem
|
||||
x:Name="menuCheckUpdateV2flyCore"
|
||||
Height="{StaticResource MenuItemHeight}"
|
||||
Header="V2fly v5 Core" />
|
||||
<MenuItem
|
||||
x:Name="menuCheckUpdateSagerNetCore"
|
||||
Height="{StaticResource MenuItemHeight}"
|
||||
Header="SagerNet Core" />-->
|
||||
<MenuItem
|
||||
x:Name="menuCheckUpdateXrayCore"
|
||||
Height="{StaticResource MenuItemHeight}"
|
||||
Header="Xray Core" />
|
||||
<!--<Separator Margin="-40,5" />
|
||||
<MenuItem
|
||||
x:Name="menuCheckUpdateClashCore"
|
||||
x:Name="menuCheckUpdateMihomoCore"
|
||||
Height="{StaticResource MenuItemHeight}"
|
||||
Header="Clash Core" />
|
||||
<MenuItem
|
||||
x:Name="menuCheckUpdateClashMetaCore"
|
||||
Height="{StaticResource MenuItemHeight}"
|
||||
Header="Clash.Meta Core" />
|
||||
<Separator Margin="-40,5" />-->
|
||||
Header="Mihomo Core" />
|
||||
<MenuItem
|
||||
x:Name="menuCheckUpdateSingBoxCore"
|
||||
Height="{StaticResource MenuItemHeight}"
|
||||
|
||||
@@ -144,11 +144,8 @@ namespace v2rayN.Views
|
||||
|
||||
//check update
|
||||
this.BindCommand(ViewModel, vm => vm.CheckUpdateNCmd, v => v.menuCheckUpdateN).DisposeWith(disposables);
|
||||
//this.BindCommand(ViewModel, vm => vm.CheckUpdateV2flyCoreCmd, v => v.menuCheckUpdateV2flyCore).DisposeWith(disposables);
|
||||
//this.BindCommand(ViewModel, vm => vm.CheckUpdateSagerNetCoreCmd, v => v.menuCheckUpdateSagerNetCore).DisposeWith(disposables);
|
||||
this.BindCommand(ViewModel, vm => vm.CheckUpdateXrayCoreCmd, v => v.menuCheckUpdateXrayCore).DisposeWith(disposables);
|
||||
//this.BindCommand(ViewModel, vm => vm.CheckUpdateClashCoreCmd, v => v.menuCheckUpdateClashCore).DisposeWith(disposables);
|
||||
//this.BindCommand(ViewModel, vm => vm.CheckUpdateClashMetaCoreCmd, v => v.menuCheckUpdateClashMetaCore).DisposeWith(disposables);
|
||||
this.BindCommand(ViewModel, vm => vm.CheckUpdateClashMetaCoreCmd, v => v.menuCheckUpdateMihomoCore).DisposeWith(disposables);
|
||||
this.BindCommand(ViewModel, vm => vm.CheckUpdateSingBoxCoreCmd, v => v.menuCheckUpdateSingBoxCore).DisposeWith(disposables);
|
||||
this.BindCommand(ViewModel, vm => vm.CheckUpdateGeoCmd, v => v.menuCheckUpdateGeo).DisposeWith(disposables);
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<ApplicationIcon>v2rayN.ico</ApplicationIcon>
|
||||
<Copyright>Copyright © 2017-2024 (GPLv3)</Copyright>
|
||||
<FileVersion>6.47</FileVersion>
|
||||
<FileVersion>6.48</FileVersion>
|
||||
<SupportedOSPlatformVersion>7.0</SupportedOSPlatformVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user