Compare commits

...

14 commits

Author SHA1 Message Date
DHR60
28432194cd
Merge 036aee564b into 214a09bc48 2026-03-13 15:06:42 +00:00
DHR60
036aee564b Fix 2026-03-13 23:06:28 +08:00
DHR60
cc3b0a5eda Add NaiveProxy support 2026-03-13 23:06:28 +08:00
DHR60
3893ac847d Add UoT support 2026-03-13 23:06:24 +08:00
2dust
214a09bc48 up 7.19.4
Some checks failed
release Linux / build (Release) (push) Has been cancelled
release macOS / build (Release) (push) Has been cancelled
release Windows desktop (Avalonia UI) / build (Release) (push) Has been cancelled
release Windows / build (Release) (push) Has been cancelled
release Linux / rpm (push) Has been cancelled
2026-03-13 10:44:20 +08:00
2dust
e6af9ab342 Fix
https://github.com/2dust/v2rayN/issues/8916
2026-03-13 10:36:58 +08:00
DHR60
0f4031f445
Update dep (#8926)
Some checks are pending
release Linux / build (Release) (push) Waiting to run
release Linux / rpm (push) Blocked by required conditions
release macOS / build (Release) (push) Waiting to run
release Windows desktop (Avalonia UI) / build (Release) (push) Waiting to run
release Windows / build (Release) (push) Waiting to run
2026-03-12 20:45:28 +08:00
2dust
5cf3d6eff6 Modify routing rule process name description
Some checks are pending
release Linux / build (Release) (push) Waiting to run
release Linux / rpm (push) Blocked by required conditions
release macOS / build (Release) (push) Waiting to run
release Windows desktop (Avalonia UI) / build (Release) (push) Waiting to run
release Windows / build (Release) (push) Waiting to run
2026-03-12 17:19:30 +08:00
2dust
17ed26cd06 Improve profile matching for Subscription, remove old option 2026-03-12 14:56:01 +08:00
2dust
5e18567ce6 Modify routing rule process name description 2026-03-12 14:21:21 +08:00
2dust
06cec89ec9 up 7.19.3
Some checks failed
release Linux / build (Release) (push) Has been cancelled
release macOS / build (Release) (push) Has been cancelled
release Windows desktop (Avalonia UI) / build (Release) (push) Has been cancelled
release Windows / build (Release) (push) Has been cancelled
release Linux / rpm (push) Has been cancelled
2026-03-10 17:38:03 +08:00
2dust
26f65dd3b2 Code cleanup: pattern matching and minor fixes 2026-03-10 17:19:21 +08:00
2dust
0c2114d2e1 Refactor SRS rule collection and add DNS parsing 2026-03-10 15:29:36 +08:00
DHR60
4af528f8e2
Typo (#8917) 2026-03-10 14:10:23 +08:00
59 changed files with 848 additions and 226 deletions

View file

@ -1,7 +1,7 @@
<Project>
<PropertyGroup>
<Version>7.19.2</Version>
<Version>7.19.4</Version>
</PropertyGroup>
<PropertyGroup>

View file

@ -9,18 +9,18 @@
<PackageVersion Include="Avalonia.Controls.DataGrid" Version="11.3.12" />
<PackageVersion Include="Avalonia.Desktop" Version="11.3.12" />
<PackageVersion Include="Avalonia.Diagnostics" Version="11.3.12" />
<PackageVersion Include="ReactiveUI.Avalonia" Version="11.3.8" />
<PackageVersion Include="ReactiveUI.Avalonia" Version="11.4.12" />
<PackageVersion Include="CliWrap" Version="3.10.0" />
<PackageVersion Include="Downloader" Version="4.1.1" />
<PackageVersion Include="Downloader" Version="5.1.0" />
<PackageVersion Include="H.NotifyIcon.Wpf" Version="2.4.1" />
<PackageVersion Include="MaterialDesignThemes" Version="5.3.0" />
<PackageVersion Include="MessageBox.Avalonia" Version="3.3.1.1" />
<PackageVersion Include="QRCoder" Version="1.7.0" />
<PackageVersion Include="ReactiveUI" Version="22.3.1" />
<PackageVersion Include="ReactiveUI" Version="23.1.8" />
<PackageVersion Include="ReactiveUI.Fody" Version="19.5.41" />
<PackageVersion Include="ReactiveUI.WPF" Version="22.3.1" />
<PackageVersion Include="ReactiveUI.WPF" Version="23.1.8" />
<PackageVersion Include="Semi.Avalonia" Version="11.3.7.3" />
<PackageVersion Include="Semi.Avalonia.AvaloniaEdit" Version="11.2.0.1" />
<PackageVersion Include="Semi.Avalonia.AvaloniaEdit" Version="11.2.0.2" />
<PackageVersion Include="Semi.Avalonia.DataGrid" Version="11.3.7.3" />
<PackageVersion Include="NLog" Version="6.1.1" />
<PackageVersion Include="sqlite-net-pcl" Version="1.9.172" />

View file

@ -13,6 +13,7 @@ public enum EConfigType
WireGuard = 9,
HTTP = 10,
Anytls = 11,
Naive = 12,
PolicyGroup = 101,
ProxyChain = 102,
}

View file

@ -95,7 +95,7 @@ public class Global
public const string PolicyGroupDefaultAllFilter = $"^(?!.*(?:{PolicyGroupExcludeKeywords})).*$";
public static readonly List<string> PolicyGroupDefaultFilterList =
public static readonly List<string> PolicyGroupDefaultFilterList =
[
// All nodes (exclude traffic/expiry info)
PolicyGroupDefaultAllFilter,
@ -193,6 +193,10 @@ public class Global
public const string Hysteria2ProtocolShare = "hy2://";
public const string NaiveHttpsProtocolShare = "naive+https://";
public const string NaiveQuicProtocolShare = "naive+quic://";
public static readonly Dictionary<EConfigType, string> ProtocolShares = new()
{
{ EConfigType.VMess, "vmess://" },
@ -203,7 +207,8 @@ public class Global
{ EConfigType.Hysteria2, "hysteria2://" },
{ EConfigType.TUIC, "tuic://" },
{ EConfigType.WireGuard, "wireguard://" },
{ EConfigType.Anytls, "anytls://" }
{ EConfigType.Anytls, "anytls://" },
{ EConfigType.Naive, "naive://" }
};
public static readonly Dictionary<EConfigType, string> ProtocolTypes = new()
@ -217,7 +222,8 @@ public class Global
{ EConfigType.Hysteria2, "hysteria2" },
{ EConfigType.TUIC, "tuic" },
{ EConfigType.WireGuard, "wireguard" },
{ EConfigType.Anytls, "anytls" }
{ EConfigType.Anytls, "anytls" },
{ EConfigType.Naive, "naive" }
};
public static readonly List<string> VmessSecurities =
@ -342,6 +348,7 @@ public class Global
EConfigType.Hysteria2,
EConfigType.TUIC,
EConfigType.Anytls,
EConfigType.Naive,
EConfigType.WireGuard,
EConfigType.SOCKS,
EConfigType.HTTP,
@ -558,6 +565,14 @@ public class Global
"bbr"
];
public static readonly List<string> NaiveCongestionControls =
[
"bbr",
"bbr2",
"cubic",
"reno"
];
public static readonly List<string> allowSelectType =
[
"selector",

View file

@ -81,7 +81,9 @@ public class NodeValidator
{
var transportError = ValidateSingboxTransport(item.ConfigType, net);
if (transportError != null)
{
v.Error(transportError);
}
if (!Global.SingboxSupportConfigType.Contains(item.ConfigType))
{
@ -150,6 +152,12 @@ public class NodeValidator
private static string? ValidateSingboxTransport(EConfigType configType, string net)
{
// Naive support tcp and quic transports
if (configType == EConfigType.Naive && net == "quic")
{
return null;
}
// sing-box does not support xhttp / kcp transports
if (SingboxUnsupportedTransports.Contains(net))
{

View file

@ -95,10 +95,7 @@ public static class ConfigHandler
config.GuiItem ??= new();
config.MsgUIItem ??= new();
config.UiItem ??= new UIItem()
{
EnableUpdateSubOnlyRemarksExist = true
};
config.UiItem ??= new();
config.UiItem.MainColumnItem ??= new();
config.UiItem.WindowSizeItem ??= new();
@ -272,6 +269,7 @@ public static class ConfigHandler
EConfigType.TUIC => await AddTuicServer(config, item),
EConfigType.WireGuard => await AddWireguardServer(config, item),
EConfigType.Anytls => await AddAnytlsServer(config, item),
EConfigType.Naive => await AddNaiveServer(config, item),
_ => -1,
};
return ret;
@ -807,7 +805,7 @@ public static class ConfigHandler
}
/// <summary>
/// Add or edit a Anytls server
/// Add or edit an Anytls server
/// Validates and processes Anytls-specific settings
/// </summary>
/// <param name="config">Current configuration</param>
@ -834,6 +832,35 @@ public static class ConfigHandler
return 0;
}
/// <summary>
/// Add or edit a Naive server
/// Validates and processes Naive-specific settings
/// </summary>
/// <param name="config">Current configuration</param>
/// <param name="profileItem">Naive profile to add</param>
/// <param name="toFile">Whether to save to file</param>
/// <returns>0 if successful, -1 if failed</returns>
public static async Task<int> AddNaiveServer(Config config, ProfileItem profileItem, bool toFile = true)
{
profileItem.ConfigType = EConfigType.Naive;
profileItem.CoreType = ECoreType.sing_box;
profileItem.Address = profileItem.Address.TrimEx();
profileItem.Username = profileItem.Username.TrimEx();
profileItem.Password = profileItem.Password.TrimEx();
profileItem.Network = profileItem.Network == "quic" ? "quic" : string.Empty;
if (profileItem.StreamSecurity.IsNullOrEmpty())
{
profileItem.StreamSecurity = Global.StreamSecurity;
}
if (profileItem.Password.IsNullOrEmpty())
{
return -1;
}
await AddServerCommon(config, profileItem, toFile);
return 0;
}
/// <summary>
/// Sort the server list by the specified column
/// Updates the sort order in the profile extension data
@ -1040,8 +1067,8 @@ public static class ConfigHandler
if (profileItem.StreamSecurity.IsNotEmpty())
{
if (profileItem.StreamSecurity != Global.StreamSecurity
&& profileItem.StreamSecurity != Global.StreamSecurityReality)
if (profileItem.StreamSecurity is not Global.StreamSecurity
and not Global.StreamSecurityReality)
{
profileItem.StreamSecurity = string.Empty;
}
@ -1080,7 +1107,8 @@ public static class ConfigHandler
if (toFile)
{
profileItem.SetProtocolExtra();
//profileItem.SetProtocolExtra();
profileItem.SetProtocolExtra(profileItem.GetProtocolExtra());
await SQLiteHelper.Instance.ReplaceAsync(profileItem);
}
return 0;
@ -1108,6 +1136,7 @@ public static class ConfigHandler
&& AreEqual(o.Address, n.Address)
&& o.Port == n.Port
&& AreEqual(o.Password, n.Password)
&& AreEqual(o.Username, n.Username)
&& AreEqual(oProtocolExtra.VlessEncryption, nProtocolExtra.VlessEncryption)
&& AreEqual(oProtocolExtra.SsMethod, nProtocolExtra.SsMethod)
&& AreEqual(oProtocolExtra.VmessSecurity, nProtocolExtra.VmessSecurity)
@ -1132,6 +1161,84 @@ public static class ConfigHandler
}
}
/// <summary>
/// Searches the specified collection for a profile item that matches the target profile item based on a series of
/// criteria.
/// </summary>
/// <remarks>The method attempts to find a match by comparing the target's remarks, address, port, and
/// password in various combinations. The search is performed in order of specificity, starting with the most
/// detailed comparison. If no match is found at any stage, the method returns null.</remarks>
/// <param name="source">An enumerable collection of profile items to search. This parameter can be null.</param>
/// <param name="target">The profile item to match against items in the source collection. This parameter can be null.</param>
/// <returns>A profile item from the source collection that matches the target item according to defined criteria; otherwise,
/// null if no match is found or if either parameter is null.</returns>
private static ProfileItem? FindMatchedProfileItem(IEnumerable<ProfileItem>? source, ProfileItem? target)
{
if (source == null || target == null)
{
return null;
}
var matchedItem = source.FirstOrDefault(t => CompareProfileItem(t, target, true));
if (matchedItem != null)
{
return matchedItem;
}
if (target.Remarks.IsNotEmpty())
{
matchedItem = source.FirstOrDefault(t => t.Remarks == target.Remarks);
if (matchedItem != null)
{
return matchedItem;
}
}
if (target.Address.IsNotEmpty() && target.Port > 0 && target.Password.IsNotEmpty())
{
matchedItem = source.FirstOrDefault(t =>
IsSameText(t.Address, target.Address) &&
t.Port == target.Port &&
IsSameText(t.Password, target.Password));
if (matchedItem != null)
{
return matchedItem;
}
}
if (target.Address.IsNotEmpty() && target.Port > 0)
{
matchedItem = source.FirstOrDefault(t =>
IsSameText(t.Address, target.Address) &&
t.Port == target.Port);
if (matchedItem != null)
{
return matchedItem;
}
}
if (target.Address.IsNotEmpty())
{
matchedItem = source.FirstOrDefault(t => IsSameText(t.Address, target.Address));
if (matchedItem != null)
{
return matchedItem;
}
}
return null;
static bool IsSameText(string? left, string? right)
{
if (left.IsNullOrEmpty() || right.IsNullOrEmpty())
{
return false;
}
return string.Equals(left.TrimEx(), right.TrimEx(), StringComparison.OrdinalIgnoreCase);
}
}
/// <summary>
/// Remove a single server profile by its index ID
/// Deletes the configuration file if it's a custom config
@ -1421,6 +1528,7 @@ public static class ConfigHandler
EConfigType.TUIC => await AddTuicServer(config, profileItem, false),
EConfigType.WireGuard => await AddWireguardServer(config, profileItem, false),
EConfigType.Anytls => await AddAnytlsServer(config, profileItem, false),
EConfigType.Naive => await AddNaiveServer(config, profileItem, false),
_ => -1,
};
@ -1636,7 +1744,7 @@ public static class ConfigHandler
if (activeProfile != null)
{
var lstSub = await AppManager.Instance.ProfileItems(subid);
var existItem = lstSub?.FirstOrDefault(t => config.UiItem.EnableUpdateSubOnlyRemarksExist ? t.Remarks == activeProfile.Remarks : CompareProfileItem(t, activeProfile, true));
var existItem = FindMatchedProfileItem(lstSub, activeProfile);
if (existItem != null)
{
await ConfigHandler.SetDefaultServerIndex(config, existItem.IndexId);
@ -1649,7 +1757,7 @@ public static class ConfigHandler
var lstSub = await AppManager.Instance.ProfileItems(subid);
foreach (var item in lstSub)
{
var existItem = lstOriSub?.FirstOrDefault(t => config.UiItem.EnableUpdateSubOnlyRemarksExist ? t.Remarks == item.Remarks : CompareProfileItem(t, item, true));
var existItem = FindMatchedProfileItem(lstOriSub, item);
if (existItem != null)
{
await StatisticsManager.Instance.CloneServerStatItem(existItem.IndexId, item.IndexId);

View file

@ -19,6 +19,7 @@ public class FmtHandler
EConfigType.TUIC => TuicFmt.ToUri(item),
EConfigType.WireGuard => WireguardFmt.ToUri(item),
EConfigType.Anytls => AnytlsFmt.ToUri(item),
EConfigType.Naive => NaiveFmt.ToUri(item),
_ => null,
};
@ -80,6 +81,12 @@ public class FmtHandler
{
return AnytlsFmt.Resolve(str, out msg);
}
else if (str.StartsWith(Global.ProtocolShares[EConfigType.Naive])
|| str.StartsWith(Global.NaiveHttpsProtocolShare)
|| str.StartsWith(Global.NaiveQuicProtocolShare))
{
return NaiveFmt.Resolve(str, out msg);
}
else
{
msg = ResUI.NonvmessOrssProtocol;

View file

@ -0,0 +1,85 @@
namespace ServiceLib.Handler.Fmt;
public class NaiveFmt : BaseFmt
{
public static ProfileItem? Resolve(string str, out string msg)
{
msg = ResUI.ConfigurationFormatIncorrect;
var parsedUrl = Utils.TryUri(str);
if (parsedUrl == null)
{
return null;
}
ProfileItem item = new()
{
ConfigType = EConfigType.Naive,
Remarks = parsedUrl.GetComponents(UriComponents.Fragment, UriFormat.Unescaped),
Address = parsedUrl.IdnHost,
Port = parsedUrl.Port,
};
if (parsedUrl.Scheme.Contains("quic"))
{
item.Network = "quic";
}
var rawUserInfo = Utils.UrlDecode(parsedUrl.UserInfo);
if (rawUserInfo.Contains(':'))
{
var split = rawUserInfo.Split(':', 2);
item.Username = split[0];
item.Password = split[1];
}
else
{
item.Password = rawUserInfo;
}
var query = Utils.ParseQueryString(parsedUrl.Query);
ResolveUriQuery(query, ref item);
var insecureConcurrency = int.TryParse(GetQueryValue(query, "insecure-concurrency"), out var ic) ? ic : 0;
if (insecureConcurrency > 0)
{
item.SetProtocolExtra(item.GetProtocolExtra() with
{
InsecureConcurrency = insecureConcurrency,
});
}
return item;
}
public static string? ToUri(ProfileItem? item)
{
if (item == null)
{
return null;
}
var remark = string.Empty;
if (item.Remarks.IsNotEmpty())
{
remark = "#" + Utils.UrlEncode(item.Remarks);
}
var userInfo = item.Username.IsNotEmpty() ? $"{Utils.UrlEncode(item.Username)}:{Utils.UrlEncode(item.Password)}" : Utils.UrlEncode(item.Password);
var dicQuery = new Dictionary<string, string>();
ToUriQuery(item, Global.None, ref dicQuery);
if (item.GetProtocolExtra().InsecureConcurrency > 0)
{
dicQuery.Add("insecure-concurrency", item.GetProtocolExtra()?.InsecureConcurrency.ToString());
}
var query = dicQuery.Count > 0
? ("?" + string.Join("&", dicQuery.Select(x => x.Key + "=" + x.Value).ToArray()))
: string.Empty;
var url = $"{userInfo}@{GetIpv6(item.Address)}:{item.Port}";
if (item.Network == "quic")
{
return $"{Global.NaiveQuicProtocolShare}{url}{query}{remark}";
}
else
{
return $"{Global.NaiveHttpsProtocolShare}{url}{query}{remark}";
}
}
}

View file

@ -30,7 +30,10 @@ public class TuicFmt : BaseFmt
var query = Utils.ParseQueryString(url.Query);
ResolveUriQuery(query, ref item);
item.HeaderType = GetQueryValue(query, "congestion_control");
item.SetProtocolExtra(item.GetProtocolExtra() with
{
CongestionControl = GetQueryValue(query, "congestion_control")
});
return item;
}
@ -51,7 +54,10 @@ public class TuicFmt : BaseFmt
var dicQuery = new Dictionary<string, string>();
ToUriQueryLite(item, ref dicQuery);
dicQuery.Add("congestion_control", item.HeaderType);
if (!item.GetProtocolExtra().CongestionControl.IsNullOrEmpty())
{
dicQuery.Add("congestion_control", item.GetProtocolExtra().CongestionControl);
}
return ToUri(EConfigType.TUIC, item.Address, item.Port, $"{item.Username ?? ""}:{item.Password}", dicQuery, remark);
}

View file

@ -305,12 +305,11 @@ public sealed class AppManager
return await SQLiteHelper.Instance.TableAsync<FullConfigTemplateItem>().FirstOrDefaultAsync(it => it.CoreType == eCoreType);
}
#pragma warning disable CS0618
public async Task MigrateProfileExtra()
{
await MigrateProfileExtraGroup();
#pragma warning disable CS0618
const int pageSize = 100;
var offset = 0;
@ -334,7 +333,6 @@ public sealed class AppManager
}
//await ProfileGroupItemManager.Instance.ClearAll();
#pragma warning restore CS0618
}
private async Task<int> MigrateProfileExtraSub(List<ProfileItem> batch)
@ -380,6 +378,7 @@ public sealed class AppManager
break;
case EConfigType.TUIC:
extra = extra with { CongestionControl = item.HeaderType.NullIfEmpty(), };
item.Username = item.Id;
item.Id = item.Security;
item.Password = item.Security;
@ -436,7 +435,6 @@ public sealed class AppManager
private async Task<bool> MigrateProfileExtraGroup()
{
#pragma warning disable CS0618
var list = await SQLiteHelper.Instance.TableAsync<ProfileGroupItem>().ToListAsync();
var groupItems = new ConcurrentDictionary<string, ProfileGroupItem>(list.Where(t => !string.IsNullOrEmpty(t.IndexId)).ToDictionary(t => t.IndexId!));
@ -501,8 +499,8 @@ public sealed class AppManager
return true;
//await ProfileGroupItemManager.Instance.ClearAll();
#pragma warning restore CS0618
}
#pragma warning restore CS0618
#endregion SqliteHelper

View file

@ -87,7 +87,6 @@ public class MsgUIItem
public class UIItem
{
public bool EnableAutoAdjustMainLvColWidth { get; set; }
public bool EnableUpdateSubOnlyRemarksExist { get; set; }
public int MainGirdHeight1 { get; set; }
public int MainGirdHeight2 { get; set; }
public EGirdOrientation MainGirdOrientation { get; set; } = EGirdOrientation.Vertical;

View file

@ -2,6 +2,9 @@ namespace ServiceLib.Models;
public record ProtocolExtraItem
{
public bool? Uot { get; init; }
public string? CongestionControl { get; init; }
// vmess
public string? AlterId { get; init; }
public string? VmessSecurity { get; init; }
@ -29,6 +32,9 @@ public record ProtocolExtraItem
public string? Ports { get; init; }
public string? HopInterval { get; init; }
// naiveproxy
public int? InsecureConcurrency { get; init; }
// group profile
public string? GroupType { get; init; }
public string? ChildItems { get; init; }

View file

@ -9,6 +9,6 @@ public class ServerTestItem
public EConfigType ConfigType { get; set; }
public bool AllowTest { get; set; }
public int QueueNum { get; set; }
public required ProfileItem Profile { get; set; }
public ProfileItem Profile { get; set; }
public ECoreType CoreType { get; set; }
}

View file

@ -134,10 +134,14 @@ public class Outbound4Sbox : BaseServer4Sbox
public int? recv_window_conn { get; set; }
public int? recv_window { get; set; }
public bool? disable_mtu_discovery { get; set; }
public int? insecure_concurrency { get; set; }
public bool? udp_over_tcp { get; set; }
public string? method { get; set; }
public string? username { get; set; }
public string? password { get; set; }
public string? congestion_control { get; set; }
public bool? quic { get; set; }
public string? quic_congestion_control { get; set; }
public string? version { get; set; }
public string? network { get; set; }
public string? packet_encoding { get; set; }

View file

@ -179,6 +179,8 @@ public class ServersItem4Ray
public string flow { get; set; }
public bool? uot { get; set; }
public List<SocksUsersItem4Ray> users { get; set; }
}

View file

@ -691,7 +691,7 @@ namespace ServiceLib.Resx {
}
/// <summary>
/// 查找类似 Add Child 的本地化字符串。
/// 查找类似 Add Child 的本地化字符串。
/// </summary>
public static string menuAddChildServer {
get {
@ -718,7 +718,7 @@ namespace ServiceLib.Resx {
}
/// <summary>
/// 查找类似 Add [Hysteria2] 的本地化字符串。
/// 查找类似 Add [Hysteria2] 的本地化字符串。
/// </summary>
public static string menuAddHysteria2Server {
get {
@ -727,7 +727,16 @@ namespace ServiceLib.Resx {
}
/// <summary>
/// 查找类似 Add Policy Group 的本地化字符串。
/// 查找类似 Add [NaïveProxy] 的本地化字符串。
/// </summary>
public static string menuAddNaiveServer {
get {
return ResourceManager.GetString("menuAddNaiveServer", resourceCulture);
}
}
/// <summary>
/// 查找类似 Add Policy Group 的本地化字符串。
/// </summary>
public static string menuAddPolicyGroupServer {
get {
@ -772,7 +781,7 @@ namespace ServiceLib.Resx {
}
/// <summary>
/// 查找类似 Add [Shadowsocks] 的本地化字符串。
/// 查找类似 Add [Shadowsocks] 的本地化字符串。
/// </summary>
public static string menuAddShadowsocksServer {
get {
@ -781,7 +790,7 @@ namespace ServiceLib.Resx {
}
/// <summary>
/// 查找类似 Add [SOCKS] 的本地化字符串。
/// 查找类似 Add [SOCKS] 的本地化字符串。
/// </summary>
public static string menuAddSocksServer {
get {
@ -790,7 +799,7 @@ namespace ServiceLib.Resx {
}
/// <summary>
/// 查找类似 Add [Trojan] 的本地化字符串。
/// 查找类似 Add [Trojan] 的本地化字符串。
/// </summary>
public static string menuAddTrojanServer {
get {
@ -799,7 +808,7 @@ namespace ServiceLib.Resx {
}
/// <summary>
/// 查找类似 Add [TUIC] 的本地化字符串。
/// 查找类似 Add [TUIC] 的本地化字符串。
/// </summary>
public static string menuAddTuicServer {
get {
@ -808,7 +817,7 @@ namespace ServiceLib.Resx {
}
/// <summary>
/// 查找类似 Add [VLESS] 的本地化字符串。
/// 查找类似 Add [VLESS] 的本地化字符串。
/// </summary>
public static string menuAddVlessServer {
get {
@ -817,7 +826,7 @@ namespace ServiceLib.Resx {
}
/// <summary>
/// 查找类似 Add [VMess] 的本地化字符串。
/// 查找类似 Add [VMess] 的本地化字符串。
/// </summary>
public static string menuAddVmessServer {
get {
@ -826,7 +835,7 @@ namespace ServiceLib.Resx {
}
/// <summary>
/// 查找类似 Add [WireGuard] 的本地化字符串。
/// 查找类似 Add [WireGuard] 的本地化字符串。
/// </summary>
public static string menuAddWireguardServer {
get {
@ -3069,6 +3078,15 @@ namespace ServiceLib.Resx {
}
}
/// <summary>
/// 查找类似 Insecure Concurrency 的本地化字符串。
/// </summary>
public static string TbInsecureConcurrency {
get {
return ResourceManager.GetString("TbInsecureConcurrency", resourceCulture);
}
}
/// <summary>
/// 查找类似 Most Stable 的本地化字符串。
/// </summary>
@ -3376,7 +3394,7 @@ namespace ServiceLib.Resx {
}
/// <summary>
/// 查找类似 Process (Tun mode) 的本地化字符串。
/// 查找类似 Process (Linux/Windows) 的本地化字符串。
/// </summary>
public static string TbRoutingRuleProcess {
get {
@ -3816,15 +3834,6 @@ namespace ServiceLib.Resx {
}
}
/// <summary>
/// 查找类似 Updating subscription, only determining if remarks exist 的本地化字符串。
/// </summary>
public static string TbSettingsEnableUpdateSubOnlyRemarksExist {
get {
return ResourceManager.GetString("TbSettingsEnableUpdateSubOnlyRemarksExist", resourceCulture);
}
}
/// <summary>
/// 查找类似 Exception 的本地化字符串。
/// </summary>
@ -4464,6 +4473,24 @@ namespace ServiceLib.Resx {
}
}
/// <summary>
/// 查找类似 UDP over TCP 的本地化字符串。
/// </summary>
public static string TbUot {
get {
return ResourceManager.GetString("TbUot", resourceCulture);
}
}
/// <summary>
/// 查找类似 Username 的本地化字符串。
/// </summary>
public static string TbUsername {
get {
return ResourceManager.GetString("TbUsername", resourceCulture);
}
}
/// <summary>
/// 查找类似 Validate Regional Domain IPs 的本地化字符串。
/// </summary>

View file

@ -1027,7 +1027,7 @@
<value>پروتکل sing-box Mux</value>
</data>
<data name="TbRoutingRuleProcess" xml:space="preserve">
<value>Process (Tun mode)</value>
<value>Process (Linux/Windows)</value>
</data>
<data name="TbRoutingRuleIP" xml:space="preserve">
<value>IP or IP CIDR</value>
@ -1098,9 +1098,6 @@
<data name="TbSettingsSpeedPingTestUrl" xml:space="preserve">
<value>آدرس اینترنتی تست پینگ سرعت</value>
</data>
<data name="TbSettingsEnableUpdateSubOnlyRemarksExist" xml:space="preserve">
<value>اشتراک در حال به‌روزرسانی، فقط مشخص کنید که ملاحظاتی آیا وجود دارد!</value>
</data>
<data name="SpeedtestingStop" xml:space="preserve">
<value>پایان تست...</value>
</data>
@ -1671,4 +1668,16 @@ The "Get Certificate" action may fail if a self-signed certificate is used or if
<data name="menuGenRegionGroup" xml:space="preserve">
<value>Group by Region</value>
</data>
<data name="TbUot" xml:space="preserve">
<value>UDP over TCP</value>
</data>
<data name="menuAddNaiveServer" xml:space="preserve">
<value>Add NaïveProxy</value>
</data>
<data name="TbInsecureConcurrency" xml:space="preserve">
<value>Insecure Concurrency</value>
</data>
<data name="TbUsername" xml:space="preserve">
<value>Username</value>
</data>
</root>

View file

@ -1024,7 +1024,7 @@
<value>Protocole de multiplexage Mux (sing-box)</value>
</data>
<data name="TbRoutingRuleProcess" xml:space="preserve">
<value>Process (Tun mode)</value>
<value>Process (Linux/Windows)</value>
</data>
<data name="TbRoutingRuleIP" xml:space="preserve">
<value>IP ou IP CIDR</value>
@ -1095,9 +1095,6 @@
<data name="TbSettingsSpeedPingTestUrl" xml:space="preserve">
<value>Adresse de test de connexion réelle</value>
</data>
<data name="TbSettingsEnableUpdateSubOnlyRemarksExist" xml:space="preserve">
<value>Ne vérifier lexistence de lalias quà la maj. des abonnements</value>
</data>
<data name="SpeedtestingStop" xml:space="preserve">
<value>Arrêt du test en cours...</value>
</data>
@ -1668,4 +1665,16 @@ The "Get Certificate" action may fail if a self-signed certificate is used or if
<data name="menuGenRegionGroup" xml:space="preserve">
<value>Group by Region</value>
</data>
</root>
<data name="TbUot" xml:space="preserve">
<value>UDP over TCP</value>
</data>
<data name="menuAddNaiveServer" xml:space="preserve">
<value>Ajouter [NaïveProxy]</value>
</data>
<data name="TbInsecureConcurrency" xml:space="preserve">
<value>Insecure Concurrency</value>
</data>
<data name="TbUsername" xml:space="preserve">
<value>Username</value>
</data>
</root>

View file

@ -1027,7 +1027,7 @@
<value>sing-box Mux protokoll</value>
</data>
<data name="TbRoutingRuleProcess" xml:space="preserve">
<value>Process (Tun mode)</value>
<value>Process (Linux/Windows)</value>
</data>
<data name="TbRoutingRuleIP" xml:space="preserve">
<value>IP vagy IP CIDR</value>
@ -1098,9 +1098,6 @@
<data name="TbSettingsSpeedPingTestUrl" xml:space="preserve">
<value>Sebesség Ping Teszt URL</value>
</data>
<data name="TbSettingsEnableUpdateSubOnlyRemarksExist" xml:space="preserve">
<value>Előfizetés frissítése, csak a megjegyzések létezésének ellenőrzése</value>
</data>
<data name="SpeedtestingStop" xml:space="preserve">
<value>Teszt megszakítása...</value>
</data>
@ -1671,4 +1668,16 @@ The "Get Certificate" action may fail if a self-signed certificate is used or if
<data name="menuGenRegionGroup" xml:space="preserve">
<value>Group by Region</value>
</data>
<data name="TbUot" xml:space="preserve">
<value>UDP over TCP</value>
</data>
<data name="menuAddNaiveServer" xml:space="preserve">
<value>[NaïveProxy] konfiguráció hozzáadása</value>
</data>
<data name="TbInsecureConcurrency" xml:space="preserve">
<value>Insecure Concurrency</value>
</data>
<data name="TbUsername" xml:space="preserve">
<value>Username</value>
</data>
</root>

View file

@ -514,19 +514,19 @@
<value>Add a custom configuration</value>
</data>
<data name="menuAddShadowsocksServer" xml:space="preserve">
<value>Add [Shadowsocks] </value>
<value>Add [Shadowsocks]</value>
</data>
<data name="menuAddSocksServer" xml:space="preserve">
<value>Add [SOCKS] </value>
<value>Add [SOCKS]</value>
</data>
<data name="menuAddTrojanServer" xml:space="preserve">
<value>Add [Trojan] </value>
<value>Add [Trojan]</value>
</data>
<data name="menuAddVlessServer" xml:space="preserve">
<value>Add [VLESS] </value>
<value>Add [VLESS]</value>
</data>
<data name="menuAddVmessServer" xml:space="preserve">
<value>Add [VMess] </value>
<value>Add [VMess]</value>
</data>
<data name="menuSelectAll" xml:space="preserve">
<value>Select all</value>
@ -1027,7 +1027,7 @@
<value>sing-box Mux Protocol</value>
</data>
<data name="TbRoutingRuleProcess" xml:space="preserve">
<value>Process (Tun mode)</value>
<value>Process (Linux/Windows)</value>
</data>
<data name="TbRoutingRuleIP" xml:space="preserve">
<value>IP or IP CIDR</value>
@ -1036,7 +1036,7 @@
<value>Domain</value>
</data>
<data name="menuAddHysteria2Server" xml:space="preserve">
<value>Add [Hysteria2] </value>
<value>Add [Hysteria2]</value>
</data>
<data name="TbSettingsHysteriaBandwidth" xml:space="preserve">
<value>Hysteria Max bandwidth (Up/Down)</value>
@ -1045,7 +1045,7 @@
<value>Use System Hosts</value>
</data>
<data name="menuAddTuicServer" xml:space="preserve">
<value>Add [TUIC] </value>
<value>Add [TUIC]</value>
</data>
<data name="TbHeaderType8" xml:space="preserve">
<value>Congestion control</value>
@ -1075,7 +1075,7 @@
<value>Enable IPv6 Address</value>
</data>
<data name="menuAddWireguardServer" xml:space="preserve">
<value>Add [WireGuard] </value>
<value>Add [WireGuard]</value>
</data>
<data name="TbPrivateKey" xml:space="preserve">
<value>Private Key</value>
@ -1098,9 +1098,6 @@
<data name="TbSettingsSpeedPingTestUrl" xml:space="preserve">
<value>Speed Ping Test URL</value>
</data>
<data name="TbSettingsEnableUpdateSubOnlyRemarksExist" xml:space="preserve">
<value>Updating subscription, only determining if remarks exist</value>
</data>
<data name="SpeedtestingStop" xml:space="preserve">
<value>Test terminating...</value>
</data>
@ -1498,13 +1495,13 @@
<value>Policy Group Type</value>
</data>
<data name="menuAddPolicyGroupServer" xml:space="preserve">
<value>Add Policy Group </value>
<value>Add Policy Group</value>
</data>
<data name="menuAddProxyChainServer" xml:space="preserve">
<value>Add Proxy Chain</value>
</data>
<data name="menuAddChildServer" xml:space="preserve">
<value>Add Child </value>
<value>Add Child</value>
</data>
<data name="menuRemoveChildServer" xml:space="preserve">
<value>Remove Child </value>
@ -1671,4 +1668,16 @@ The "Get Certificate" action may fail if a self-signed certificate is used or if
<data name="menuGenRegionGroup" xml:space="preserve">
<value>Group by Region</value>
</data>
<data name="TbUot" xml:space="preserve">
<value>UDP over TCP</value>
</data>
<data name="menuAddNaiveServer" xml:space="preserve">
<value>Add [NaïveProxy]</value>
</data>
<data name="TbInsecureConcurrency" xml:space="preserve">
<value>Insecure Concurrency</value>
</data>
<data name="TbUsername" xml:space="preserve">
<value>Username</value>
</data>
</root>

View file

@ -1027,7 +1027,7 @@
<value>Протокол Mux для sing-box</value>
</data>
<data name="TbRoutingRuleProcess" xml:space="preserve">
<value>Process (Tun mode)</value>
<value>Process (Linux/Windows)</value>
</data>
<data name="TbRoutingRuleIP" xml:space="preserve">
<value>IP-адрес или сеть CIDR</value>
@ -1098,9 +1098,6 @@
<data name="TbSettingsSpeedPingTestUrl" xml:space="preserve">
<value>URL для быстрой проверки реальной задержки</value>
</data>
<data name="TbSettingsEnableUpdateSubOnlyRemarksExist" xml:space="preserve">
<value>Обновляя подписку, проверять лишь наличие примечаний</value>
</data>
<data name="SpeedtestingStop" xml:space="preserve">
<value>Отмена тестирования...</value>
</data>
@ -1671,4 +1668,16 @@ The "Get Certificate" action may fail if a self-signed certificate is used or if
<data name="menuGenRegionGroup" xml:space="preserve">
<value>Group by Region</value>
</data>
<data name="TbUot" xml:space="preserve">
<value>UDP over TCP</value>
</data>
<data name="menuAddNaiveServer" xml:space="preserve">
<value>Добавить сервер [NaïveProxy]</value>
</data>
<data name="TbInsecureConcurrency" xml:space="preserve">
<value>Insecure Concurrency</value>
</data>
<data name="TbUsername" xml:space="preserve">
<value>Username</value>
</data>
</root>

View file

@ -517,16 +517,16 @@
<value>添加 [Shadowsocks]</value>
</data>
<data name="menuAddSocksServer" xml:space="preserve">
<value>添加 [SOCKS] </value>
<value>添加 [SOCKS]</value>
</data>
<data name="menuAddTrojanServer" xml:space="preserve">
<value>添加 [Trojan] </value>
<value>添加 [Trojan]</value>
</data>
<data name="menuAddVlessServer" xml:space="preserve">
<value>添加 [VLESS] </value>
<value>添加 [VLESS]</value>
</data>
<data name="menuAddVmessServer" xml:space="preserve">
<value>添加 [VMess] </value>
<value>添加 [VMess]</value>
</data>
<data name="menuSelectAll" xml:space="preserve">
<value>全选</value>
@ -1024,7 +1024,7 @@
<value>sing-box Mux 多路复用协议</value>
</data>
<data name="TbRoutingRuleProcess" xml:space="preserve">
<value>进程 (Tun 模式)</value>
<value>进程 (Linux/Windows)</value>
</data>
<data name="TbRoutingRuleIP" xml:space="preserve">
<value>IP 或 IP CIDR</value>
@ -1033,7 +1033,7 @@
<value>Domain</value>
</data>
<data name="menuAddHysteria2Server" xml:space="preserve">
<value>添加 [Hysteria2] </value>
<value>添加 [Hysteria2]</value>
</data>
<data name="TbSettingsHysteriaBandwidth" xml:space="preserve">
<value>Hysteria 最大带宽 (Up/Dw)</value>
@ -1042,7 +1042,7 @@
<value>使用系统 hosts</value>
</data>
<data name="menuAddTuicServer" xml:space="preserve">
<value>添加 [TUIC] </value>
<value>添加 [TUIC]</value>
</data>
<data name="TbHeaderType8" xml:space="preserve">
<value>拥塞控制算法</value>
@ -1072,7 +1072,7 @@
<value>启用 IPv6</value>
</data>
<data name="menuAddWireguardServer" xml:space="preserve">
<value>添加 [WireGuard] </value>
<value>添加 [WireGuard]</value>
</data>
<data name="TbPrivateKey" xml:space="preserve">
<value>PrivateKey</value>
@ -1095,9 +1095,6 @@
<data name="TbSettingsSpeedPingTestUrl" xml:space="preserve">
<value>真连接测试地址</value>
</data>
<data name="TbSettingsEnableUpdateSubOnlyRemarksExist" xml:space="preserve">
<value>更新订阅时只判断别名已存在否</value>
</data>
<data name="SpeedtestingStop" xml:space="preserve">
<value>测试终止中...</value>
</data>
@ -1105,7 +1102,7 @@
<value>*grpc Authority</value>
</data>
<data name="menuAddHttpServer" xml:space="preserve">
<value>添加 [HTTP] </value>
<value>添加 [HTTP]</value>
</data>
<data name="TbSettingsEnableFragment" xml:space="preserve">
<value>启用分片 (Fragment)</value>
@ -1384,7 +1381,7 @@
<value>Mldsa65Verify</value>
</data>
<data name="menuAddAnytlsServer" xml:space="preserve">
<value>添加 [Anytls] </value>
<value>添加 [Anytls]</value>
</data>
<data name="TbRemoteDNS" xml:space="preserve">
<value>远程 DNS</value>
@ -1668,4 +1665,16 @@
<data name="menuGenRegionGroup" xml:space="preserve">
<value>按地区分组</value>
</data>
<data name="TbUot" xml:space="preserve">
<value>UDP over TCP</value>
</data>
<data name="menuAddNaiveServer" xml:space="preserve">
<value>添加 [NaïveProxy]</value>
</data>
<data name="TbInsecureConcurrency" xml:space="preserve">
<value>不安全并发</value>
</data>
<data name="TbUsername" xml:space="preserve">
<value>用户名</value>
</data>
</root>

View file

@ -1024,7 +1024,7 @@
<value>sing-box Mux 多路復用協定</value>
</data>
<data name="TbRoutingRuleProcess" xml:space="preserve">
<value>行程 (Tun 模式)</value>
<value>行程 (Linux/Windows)</value>
</data>
<data name="TbRoutingRuleIP" xml:space="preserve">
<value>IP 或 IP CIDR</value>
@ -1095,9 +1095,6 @@
<data name="TbSettingsSpeedPingTestUrl" xml:space="preserve">
<value>真連線測試位址</value>
</data>
<data name="TbSettingsEnableUpdateSubOnlyRemarksExist" xml:space="preserve">
<value>更新訂閱時只判斷別名是否存在</value>
</data>
<data name="SpeedtestingStop" xml:space="preserve">
<value>測試終止中...</value>
</data>
@ -1668,4 +1665,16 @@
<data name="menuGenRegionGroup" xml:space="preserve">
<value>按區域分組</value>
</data>
<data name="TbUot" xml:space="preserve">
<value>UDP over TCP</value>
</data>
<data name="menuAddNaiveServer" xml:space="preserve">
<value>新增 [NaïveProxy] 節點</value>
</data>
<data name="TbInsecureConcurrency" xml:space="preserve">
<value>Insecure Concurrency</value>
</data>
<data name="TbUsername" xml:space="preserve">
<value>Username</value>
</data>
</root>

View file

@ -243,7 +243,6 @@ public partial class CoreConfigSingboxService
if (Utils.IsIpv6(predefined))
{
rule.answer = new List<string> { $"*. IN AAAA {predefined}" };
}
else
{

View file

@ -112,6 +112,7 @@ public partial class CoreConfigSingboxService
outbound.method = AppManager.Instance.GetShadowsocksSecurities(_node).Contains(protocolExtra.SsMethod)
? protocolExtra.SsMethod : Global.None;
outbound.password = _node.Password;
outbound.udp_over_tcp = protocolExtra.Uot == true ? true : null;
if (_node.Network == nameof(ETransport.tcp) && _node.HeaderType == Global.TcpHeaderHttp)
{
@ -269,7 +270,7 @@ public partial class CoreConfigSingboxService
{
outbound.uuid = _node.Username;
outbound.password = _node.Password;
outbound.congestion_control = _node.HeaderType;
outbound.congestion_control = protocolExtra.CongestionControl;
break;
}
case EConfigType.Anytls:
@ -277,6 +278,22 @@ public partial class CoreConfigSingboxService
outbound.password = _node.Password;
break;
}
case EConfigType.Naive:
{
outbound.username = _node.Username;
outbound.password = _node.Password;
if (outbound.network == "quic")
{
outbound.quic = true;
outbound.quic_congestion_control = protocolExtra.CongestionControl.NullIfEmpty();
}
if (protocolExtra.InsecureConcurrency > 0)
{
outbound.insecure_concurrency = protocolExtra.InsecureConcurrency;
}
outbound.udp_over_tcp = protocolExtra.Uot == true ? true : null;
break;
}
}
FillOutboundTls(outbound);

View file

@ -321,19 +321,19 @@ public partial class CoreConfigV2rayService(CoreConfigContext context)
{
outbound.streamSettings ??= new();
outbound.streamSettings.sockopt ??= new();
outbound.streamSettings.sockopt.dialerProxy = "tun-project-ss";
outbound.streamSettings.sockopt.dialerProxy = "tun-protect-ss";
}
// ech protected
foreach (var outbound in _coreConfig.outbounds
.Where(outbound => outbound.streamSettings?.tlsSettings?.echConfigList?.IsNullOrEmpty() == false))
{
outbound.streamSettings!.tlsSettings!.echSockopt ??= new();
outbound.streamSettings.tlsSettings.echSockopt.dialerProxy = "tun-project-ss";
outbound.streamSettings.tlsSettings.echSockopt.dialerProxy = "tun-protect-ss";
}
_coreConfig.outbounds.Add(new CoreConfigV2rayService(context with
{
Node = protectNode,
}).BuildProxyOutbound("tun-project-ss"));
}).BuildProxyOutbound("tun-protect-ss"));
_coreConfig.routing.rules ??= [];
var hasBalancer = _coreConfig.routing.balancers is { Count: > 0 };

View file

@ -153,6 +153,7 @@ public partial class CoreConfigV2rayService
serversItem.password = _node.Password;
serversItem.method = AppManager.Instance.GetShadowsocksSecurities(_node).Contains(protocolExtra.SsMethod)
? protocolExtra.SsMethod : "none";
serversItem.uot = protocolExtra.Uot == true ? true : null;
serversItem.ota = false;
serversItem.level = 1;

View file

@ -363,44 +363,36 @@ public class UpdateService(Config config, Func<bool, string, Task> updateFunc)
var geoipFiles = new List<string>();
var geoSiteFiles = new List<string>();
//Collect used files list
// Collect from routing rules
var routingItems = await AppManager.Instance.RoutingItems();
foreach (var routing in routingItems)
{
var rules = JsonUtils.Deserialize<List<RulesItem>>(routing.RuleSet);
foreach (var item in rules ?? [])
{
foreach (var ip in item.Ip ?? [])
{
var prefix = "geoip:";
if (ip.StartsWith(prefix))
{
geoipFiles.Add(ip.Substring(prefix.Length));
}
}
foreach (var domain in item.Domain ?? [])
{
var prefix = "geosite:";
if (domain.StartsWith(prefix))
{
geoSiteFiles.Add(domain.Substring(prefix.Length));
}
}
AddPrefixedItems(item.Ip, "geoip:", geoipFiles);
AddPrefixedItems(item.Domain, "geosite:", geoSiteFiles);
}
}
//append dns items TODO
geoSiteFiles.Add("google");
geoSiteFiles.Add("cn");
geoSiteFiles.Add("geolocation-cn");
geoSiteFiles.Add("category-ads-all");
// Collect from DNS configuration
var dnsItem = await AppManager.Instance.GetDNSItem(ECoreType.sing_box);
if (dnsItem != null)
{
ExtractDnsRuleSets(dnsItem.NormalDNS, geoipFiles, geoSiteFiles);
ExtractDnsRuleSets(dnsItem.TunDNS, geoipFiles, geoSiteFiles);
}
// Append default items
geoSiteFiles.AddRange(["google", "cn", "geolocation-cn", "category-ads-all"]);
// Download files
var path = Utils.GetBinPath("srss");
if (!Directory.Exists(path))
{
Directory.CreateDirectory(path);
}
foreach (var item in geoipFiles.Distinct())
{
await UpdateSrsFile("geoip", item);
@ -412,6 +404,63 @@ public class UpdateService(Config config, Func<bool, string, Task> updateFunc)
}
}
private void AddPrefixedItems(List<string>? items, string prefix, List<string> output)
{
if (items == null)
{
return;
}
foreach (var item in items)
{
if (item.StartsWith(prefix))
{
output.Add(item.Substring(prefix.Length));
}
}
}
private void ExtractDnsRuleSets(string? dnsJson, List<string> geoipFiles, List<string> geoSiteFiles)
{
if (string.IsNullOrEmpty(dnsJson))
{
return;
}
try
{
var dns = JsonUtils.Deserialize<Dns4Sbox>(dnsJson);
if (dns?.rules != null)
{
foreach (var rule in dns.rules)
{
ExtractSrsRuleSets(rule, geoipFiles, geoSiteFiles);
}
}
}
catch { }
}
private void ExtractSrsRuleSets(Rule4Sbox? rule, List<string> geoipFiles, List<string> geoSiteFiles)
{
if (rule == null)
{
return;
}
AddPrefixedItems(rule.rule_set, "geosite-", geoSiteFiles);
AddPrefixedItems(rule.rule_set, "geoip-", geoipFiles);
// Handle nested rules recursively
if (rule.rules != null)
{
foreach (var nestedRule in rule.rules)
{
ExtractSrsRuleSets(nestedRule, geoipFiles, geoSiteFiles);
}
}
}
private async Task UpdateSrsFile(string type, string srsName)
{
var srsUrl = string.IsNullOrEmpty(_config.ConstItem.SrsSourceUrl)

View file

@ -61,6 +61,15 @@ public class AddServerViewModel : MyReactiveObject
[Reactive]
public int WgMtu { get; set; }
[Reactive]
public bool Uot { get; set; }
[Reactive]
public string CongestionControl { get; set; }
[Reactive]
public int InsecureConcurrency { get; set; }
public ReactiveCommand<Unit, Unit> FetchCertCmd { get; }
public ReactiveCommand<Unit, Unit> FetchCertChainCmd { get; }
public ReactiveCommand<Unit, Unit> SaveCmd { get; }
@ -123,6 +132,9 @@ public class AddServerViewModel : MyReactiveObject
WgInterfaceAddress = protocolExtra?.WgInterfaceAddress ?? string.Empty;
WgReserved = protocolExtra?.WgReserved ?? string.Empty;
WgMtu = protocolExtra?.WgMtu ?? 1280;
Uot = protocolExtra?.Uot ?? false;
CongestionControl = protocolExtra?.CongestionControl ?? string.Empty;
InsecureConcurrency = protocolExtra?.InsecureConcurrency ?? 0;
}
private async Task SaveServerAsync()
@ -185,6 +197,9 @@ public class AddServerViewModel : MyReactiveObject
WgInterfaceAddress = WgInterfaceAddress.NullIfEmpty(),
WgReserved = WgReserved.NullIfEmpty(),
WgMtu = WgMtu >= 576 ? WgMtu : null,
Uot = Uot ? true : null,
CongestionControl = CongestionControl.NullIfEmpty(),
InsecureConcurrency = InsecureConcurrency > 0 ? InsecureConcurrency : null
});
if (await ConfigHandler.AddServer(_config, SelectedSource) == 0)

View file

@ -204,7 +204,7 @@ public class CheckUpdateViewModel : MyReactiveObject
private async Task UpdateFinishedSub(bool blReload)
{
RxApp.MainThreadScheduler.Schedule(blReload, (scheduler, blReload) =>
RxSchedulers.MainThreadScheduler.Schedule(blReload, (scheduler, blReload) =>
{
_ = UpdateFinishedResult(blReload);
return Disposable.Empty;
@ -317,7 +317,7 @@ public class CheckUpdateViewModel : MyReactiveObject
Remarks = msg,
};
RxApp.MainThreadScheduler.Schedule(item, (scheduler, model) =>
RxSchedulers.MainThreadScheduler.Schedule(item, (scheduler, model) =>
{
_ = UpdateViewResult(model);
return Disposable.Empty;

View file

@ -56,7 +56,7 @@ public class ClashConnectionsViewModel : MyReactiveObject
return;
}
RxApp.MainThreadScheduler.Schedule(ret?.connections, (scheduler, model) =>
RxSchedulers.MainThreadScheduler.Schedule(ret?.connections, (scheduler, model) =>
{
_ = RefreshConnections(model);
return Disposable.Empty;

View file

@ -90,7 +90,7 @@ public class ClashProxiesViewModel : MyReactiveObject
AppEvents.ProxiesReloadRequested
.AsObservable()
.ObserveOn(RxApp.MainThreadScheduler)
.ObserveOn(RxSchedulers.MainThreadScheduler)
.Subscribe(async _ => await ProxiesReload());
#endregion AppEvents
@ -173,7 +173,7 @@ public class ClashProxiesViewModel : MyReactiveObject
if (refreshUI)
{
RxApp.MainThreadScheduler.Schedule(() => _ = RefreshProxyGroups());
RxSchedulers.MainThreadScheduler.Schedule(() => _ = RefreshProxyGroups());
}
}
@ -387,7 +387,7 @@ public class ClashProxiesViewModel : MyReactiveObject
}
var model = new SpeedTestResult() { IndexId = item.Name, Delay = result };
RxApp.MainThreadScheduler.Schedule(model, (scheduler, model) =>
RxSchedulers.MainThreadScheduler.Schedule(model, (scheduler, model) =>
{
_ = ProxiesDelayTestResult(model);
return Disposable.Empty;

View file

@ -18,6 +18,7 @@ public class MainWindowViewModel : MyReactiveObject
public ReactiveCommand<Unit, Unit> AddTuicServerCmd { get; }
public ReactiveCommand<Unit, Unit> AddWireguardServerCmd { get; }
public ReactiveCommand<Unit, Unit> AddAnytlsServerCmd { get; }
public ReactiveCommand<Unit, Unit> AddNaiveServerCmd { get; }
public ReactiveCommand<Unit, Unit> AddCustomServerCmd { get; }
public ReactiveCommand<Unit, Unit> AddPolicyGroupServerCmd { get; }
public ReactiveCommand<Unit, Unit> AddProxyChainServerCmd { get; }
@ -117,6 +118,10 @@ public class MainWindowViewModel : MyReactiveObject
{
await AddServerAsync(EConfigType.Anytls);
});
AddNaiveServerCmd = ReactiveCommand.CreateFromTask(async () =>
{
await AddServerAsync(EConfigType.Naive);
});
AddCustomServerCmd = ReactiveCommand.CreateFromTask(async () =>
{
await AddServerAsync(EConfigType.Custom);
@ -228,22 +233,22 @@ public class MainWindowViewModel : MyReactiveObject
AppEvents.ReloadRequested
.AsObservable()
.ObserveOn(RxApp.MainThreadScheduler)
.ObserveOn(RxSchedulers.MainThreadScheduler)
.Subscribe(async _ => await Reload());
AppEvents.AddServerViaScanRequested
.AsObservable()
.ObserveOn(RxApp.MainThreadScheduler)
.ObserveOn(RxSchedulers.MainThreadScheduler)
.Subscribe(async _ => await AddServerViaScanAsync());
AppEvents.AddServerViaClipboardRequested
.AsObservable()
.ObserveOn(RxApp.MainThreadScheduler)
.ObserveOn(RxSchedulers.MainThreadScheduler)
.Subscribe(async _ => await AddServerViaClipboardAsync(null));
AppEvents.SubscriptionsUpdateRequested
.AsObservable()
.ObserveOn(RxApp.MainThreadScheduler)
.ObserveOn(RxSchedulers.MainThreadScheduler)
.Subscribe(async blProxy => await UpdateSubscriptionProcess("", blProxy));
#endregion AppEvents
@ -583,7 +588,7 @@ public class MainWindowViewModel : MyReactiveObject
private void ReloadResult(bool showClashUI)
{
RxApp.MainThreadScheduler.Schedule(() =>
RxSchedulers.MainThreadScheduler.Schedule(() =>
{
ShowClashUI = showClashUI;
TabMainSelectedIndex = showClashUI ? TabMainSelectedIndex : 0;
@ -592,7 +597,7 @@ public class MainWindowViewModel : MyReactiveObject
private void SetReloadEnabled(bool enabled)
{
RxApp.MainThreadScheduler.Schedule(() => BlReloadEnabled = enabled);
RxSchedulers.MainThreadScheduler.Schedule(() => BlReloadEnabled = enabled);
}
private async Task LoadCore(CoreConfigContext? mainContext, CoreConfigContext? preContext)

View file

@ -31,7 +31,7 @@ public class MsgViewModel : MyReactiveObject
AppEvents.SendMsgViewRequested
.AsObservable()
//.ObserveOn(RxApp.MainThreadScheduler)
//.ObserveOn(RxSchedulers.MainThreadScheduler)
.Subscribe(content => _ = AppendQueueMsg(content));
}

View file

@ -47,7 +47,6 @@ public class OptionSettingViewModel : MyReactiveObject
[Reactive] public bool KeepOlderDedupl { get; set; }
[Reactive] public bool DisplayRealTimeSpeed { get; set; }
[Reactive] public bool EnableAutoAdjustMainLvColWidth { get; set; }
[Reactive] public bool EnableUpdateSubOnlyRemarksExist { get; set; }
[Reactive] public bool AutoHideStartup { get; set; }
[Reactive] public bool Hide2TrayWhenClose { get; set; }
[Reactive] public bool MacOSShowInDock { get; set; }
@ -180,7 +179,6 @@ public class OptionSettingViewModel : MyReactiveObject
DisplayRealTimeSpeed = _config.GuiItem.DisplayRealTimeSpeed;
KeepOlderDedupl = _config.GuiItem.KeepOlderDedupl;
EnableAutoAdjustMainLvColWidth = _config.UiItem.EnableAutoAdjustMainLvColWidth;
EnableUpdateSubOnlyRemarksExist = _config.UiItem.EnableUpdateSubOnlyRemarksExist;
AutoHideStartup = _config.UiItem.AutoHideStartup;
Hide2TrayWhenClose = _config.UiItem.Hide2TrayWhenClose;
MacOSShowInDock = _config.UiItem.MacOSShowInDock;
@ -345,7 +343,6 @@ public class OptionSettingViewModel : MyReactiveObject
_config.GuiItem.DisplayRealTimeSpeed = DisplayRealTimeSpeed;
_config.GuiItem.KeepOlderDedupl = KeepOlderDedupl;
_config.UiItem.EnableAutoAdjustMainLvColWidth = EnableAutoAdjustMainLvColWidth;
_config.UiItem.EnableUpdateSubOnlyRemarksExist = EnableUpdateSubOnlyRemarksExist;
_config.UiItem.AutoHideStartup = AutoHideStartup;
_config.UiItem.Hide2TrayWhenClose = Hide2TrayWhenClose;
_config.UiItem.MacOSShowInDock = MacOSShowInDock;

View file

@ -188,14 +188,9 @@ public class ProfilesSelectViewModel : MyReactiveObject
{
SubItems.Add(item);
}
if (_subIndexId != null && SubItems.FirstOrDefault(t => t.Id == _subIndexId) != null)
{
SelectedSub = SubItems.FirstOrDefault(t => t.Id == _subIndexId);
}
else
{
SelectedSub = SubItems.First();
}
SelectedSub = (_config.SubIndexId.IsNotEmpty()
? SubItems.FirstOrDefault(t => t.Id == _config.SubIndexId)
: null) ?? SubItems.LastOrDefault();
}
private async Task<List<ProfileItemModel>?> GetProfileItemsEx(string subid, string filter)

View file

@ -228,22 +228,22 @@ public class ProfilesViewModel : MyReactiveObject
AppEvents.ProfilesRefreshRequested
.AsObservable()
.ObserveOn(RxApp.MainThreadScheduler)
.ObserveOn(RxSchedulers.MainThreadScheduler)
.Subscribe(async _ => await RefreshServersBiz());
AppEvents.SubscriptionsRefreshRequested
.AsObservable()
.ObserveOn(RxApp.MainThreadScheduler)
.ObserveOn(RxSchedulers.MainThreadScheduler)
.Subscribe(async _ => await RefreshSubscriptions());
AppEvents.DispatcherStatisticsRequested
.AsObservable()
.ObserveOn(RxApp.MainThreadScheduler)
.ObserveOn(RxSchedulers.MainThreadScheduler)
.Subscribe(async result => await UpdateStatistics(result));
AppEvents.SetDefaultServerRequested
.AsObservable()
.ObserveOn(RxApp.MainThreadScheduler)
.ObserveOn(RxSchedulers.MainThreadScheduler)
.Subscribe(async indexId => await SetDefaultServer(indexId));
#endregion AppEvents
@ -391,14 +391,9 @@ public class ProfilesViewModel : MyReactiveObject
{
SubItems.Add(item);
}
if (_config.SubIndexId != null && SubItems.FirstOrDefault(t => t.Id == _config.SubIndexId) != null)
{
SelectedSub = SubItems.FirstOrDefault(t => t.Id == _config.SubIndexId);
}
else
{
SelectedSub = SubItems.First();
}
SelectedSub = (_config.SubIndexId.IsNotEmpty()
? SubItems.FirstOrDefault(t => t.Id == _config.SubIndexId)
: null) ?? SubItems.LastOrDefault();
}
private async Task<List<ProfileItemModel>?> GetProfileItemsEx(string subid, string filter)
@ -732,7 +727,7 @@ public class ProfilesViewModel : MyReactiveObject
_speedtestService ??= new SpeedtestService(_config, async (SpeedTestResult result) =>
{
RxApp.MainThreadScheduler.Schedule(result, (scheduler, result) =>
RxSchedulers.MainThreadScheduler.Schedule(result, (scheduler, result) =>
{
_ = SetSpeedTestResult(result);
return Disposable.Empty;

View file

@ -200,27 +200,27 @@ public class StatusBarViewModel : MyReactiveObject
AppEvents.DispatcherStatisticsRequested
.AsObservable()
.ObserveOn(RxApp.MainThreadScheduler)
.ObserveOn(RxSchedulers.MainThreadScheduler)
.Subscribe(async result => await UpdateStatistics(result));
AppEvents.RoutingsMenuRefreshRequested
.AsObservable()
.ObserveOn(RxApp.MainThreadScheduler)
.ObserveOn(RxSchedulers.MainThreadScheduler)
.Subscribe(async _ => await RefreshRoutingsMenu());
AppEvents.TestServerRequested
.AsObservable()
.ObserveOn(RxApp.MainThreadScheduler)
.ObserveOn(RxSchedulers.MainThreadScheduler)
.Subscribe(async _ => await TestServerAvailability());
AppEvents.InboundDisplayRequested
.AsObservable()
.ObserveOn(RxApp.MainThreadScheduler)
.ObserveOn(RxSchedulers.MainThreadScheduler)
.Subscribe(async _ => await InboundDisplayStatus());
AppEvents.SysProxyChangeRequested
.AsObservable()
.ObserveOn(RxApp.MainThreadScheduler)
.ObserveOn(RxSchedulers.MainThreadScheduler)
.Subscribe(async result => await SetListenerType(result));
#endregion AppEvents
@ -243,7 +243,7 @@ public class StatusBarViewModel : MyReactiveObject
{
AppEvents.ProfilesRefreshRequested
.AsObservable()
.ObserveOn(RxApp.MainThreadScheduler)
.ObserveOn(RxSchedulers.MainThreadScheduler)
.Subscribe(async _ => await RefreshServersBiz()); //.DisposeWith(_disposables);
}
}
@ -362,7 +362,7 @@ public class StatusBarViewModel : MyReactiveObject
private async Task TestServerAvailabilitySub(string msg)
{
RxApp.MainThreadScheduler.Schedule(msg, (scheduler, msg) =>
RxSchedulers.MainThreadScheduler.Schedule(msg, (scheduler, msg) =>
{
_ = TestServerAvailabilityResult(msg);
return Disposable.Empty;

View file

@ -59,7 +59,7 @@ internal class Program
//.WithInterFont()
.WithFontByDefault()
.LogToTrace()
.UseReactiveUI();
.UseReactiveUI(_ => { });
if (OperatingSystem.IsMacOS())
{

View file

@ -197,6 +197,19 @@
Width="300"
Margin="{StaticResource Margin4}" />
<TextBlock
Grid.Row="3"
Grid.Column="0"
Margin="{StaticResource Margin4}"
VerticalAlignment="Center"
Text="{x:Static resx:ResUI.TbUot}" />
<ToggleSwitch
x:Name="togUotEnabled3"
Grid.Row="3"
Grid.Column="1"
Margin="{StaticResource Margin4}"
HorizontalAlignment="Left" />
<TextBlock
Grid.Row="4"
Grid.Column="0"
@ -580,12 +593,84 @@
VerticalAlignment="Center"
Text="{x:Static resx:ResUI.TbId3}" />
<TextBox
x:Name="txtId10"
x:Name="txtId11"
Grid.Row="1"
Grid.Column="1"
Width="400"
Margin="{StaticResource Margin4}" />
</Grid>
<Grid
x:Name="gridNaive"
Grid.Row="2"
ColumnDefinitions="300,Auto"
IsVisible="False"
RowDefinitions="Auto,Auto,Auto,Auto,Auto,Auto">
<TextBlock
Grid.Row="1"
Grid.Column="0"
Margin="{StaticResource Margin4}"
VerticalAlignment="Center"
Text="{x:Static resx:ResUI.TbUsername}" />
<TextBox
x:Name="txtId12"
Grid.Row="1"
Grid.Column="1"
Width="400"
Margin="{StaticResource Margin4}" />
<TextBlock
Grid.Row="2"
Grid.Column="0"
Margin="{StaticResource Margin4}"
VerticalAlignment="Center"
Text="{x:Static resx:ResUI.TbId3}" />
<TextBox
x:Name="txtSecurity12"
Grid.Row="2"
Grid.Column="1"
Width="400"
Margin="{StaticResource Margin4}" />
<TextBlock
Grid.Row="3"
Grid.Column="0"
Margin="{StaticResource Margin4}"
VerticalAlignment="Center"
Text="{x:Static resx:ResUI.TbInsecureConcurrency}" />
<TextBox
x:Name="txtInsecureConcurrency12"
Grid.Row="3"
Grid.Column="1"
Width="200"
Margin="{StaticResource Margin4}"
HorizontalAlignment="Left" />
<TextBlock
Grid.Row="4"
Grid.Column="0"
Margin="{StaticResource Margin4}"
VerticalAlignment="Center"
Text="{x:Static resx:ResUI.TbHeaderType8}" />
<ComboBox
x:Name="cmbHeaderType12"
Grid.Row="4"
Grid.Column="1"
Width="200"
Margin="{StaticResource Margin4}" />
<TextBlock
Grid.Row="5"
Grid.Column="0"
Margin="{StaticResource Margin4}"
VerticalAlignment="Center"
Text="{x:Static resx:ResUI.TbUot}" />
<ToggleSwitch
x:Name="togUotEnabled12"
Grid.Row="5"
Grid.Column="1"
Margin="{StaticResource Margin4}"
HorizontalAlignment="Left" />
</Grid>
<Separator
x:Name="sepa2"

View file

@ -94,10 +94,24 @@ public partial class AddServerWindow : WindowBase<AddServerViewModel>
case EConfigType.Anytls:
gridAnytls.IsVisible = true;
sepa2.IsVisible = false;
gridTransport.IsVisible = false;
lstStreamSecurity.Add(Global.StreamSecurityReality);
cmbCoreType.IsEnabled = false;
gridFinalmask.IsVisible = false;
break;
case EConfigType.Naive:
gridNaive.IsVisible = true;
cmbCoreType.IsEnabled = false;
gridFinalmask.IsVisible = false;
cmbFingerprint.IsEnabled = false;
cmbFingerprint.SelectedValue = string.Empty;
cmbAllowInsecure.IsEnabled = false;
cmbAllowInsecure.SelectedValue = string.Empty;
cmbHeaderType12.ItemsSource = Global.NaiveCongestionControls;
break;
}
cmbStreamSecurity.ItemsSource = lstStreamSecurity;
@ -122,6 +136,7 @@ public partial class AddServerWindow : WindowBase<AddServerViewModel>
case EConfigType.Shadowsocks:
this.Bind(ViewModel, vm => vm.SelectedSource.Password, v => v.txtId3.Text).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.SsMethod, v => v.cmbSecurity3.SelectedValue).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.Uot, v => v.togUotEnabled3.IsChecked).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.SelectedSource.MuxEnabled, v => v.togmuxEnabled3.IsChecked).DisposeWith(disposables);
break;
@ -156,7 +171,7 @@ public partial class AddServerWindow : WindowBase<AddServerViewModel>
case EConfigType.TUIC:
this.Bind(ViewModel, vm => vm.SelectedSource.Username, v => v.txtId8.Text).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.SelectedSource.Password, v => v.txtSecurity8.Text).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.SelectedSource.HeaderType, v => v.cmbHeaderType8.SelectedValue).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.CongestionControl, v => v.cmbHeaderType8.SelectedValue).DisposeWith(disposables);
break;
case EConfigType.WireGuard:
@ -168,7 +183,15 @@ public partial class AddServerWindow : WindowBase<AddServerViewModel>
break;
case EConfigType.Anytls:
this.Bind(ViewModel, vm => vm.SelectedSource.Password, v => v.txtId10.Text).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.SelectedSource.Password, v => v.txtId11.Text).DisposeWith(disposables);
break;
case EConfigType.Naive:
this.Bind(ViewModel, vm => vm.SelectedSource.Username, v => v.txtId12.Text).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.SelectedSource.Password, v => v.txtSecurity12.Text).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.InsecureConcurrency, v => v.txtInsecureConcurrency12.Text).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.CongestionControl, v => v.cmbHeaderType12.SelectedValue).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.Uot, v => v.togUotEnabled12.IsChecked).DisposeWith(disposables);
break;
}
this.Bind(ViewModel, vm => vm.SelectedSource.Network, v => v.cmbNetwork.SelectedValue).DisposeWith(disposables);

View file

@ -8,9 +8,9 @@ public partial class ClashConnectionsView : ReactiveUserControl<ClashConnections
public ClashConnectionsView()
{
InitializeComponent();
_config = AppManager.Instance.Config;
ViewModel = new ClashConnectionsViewModel(UpdateViewHandler);
btnAutofitColumnWidth.Click += BtnAutofitColumnWidth_Click;
@ -28,7 +28,7 @@ public partial class ClashConnectionsView : ReactiveUserControl<ClashConnections
AppEvents.AppExitRequested
.AsObservable()
.ObserveOn(RxApp.MainThreadScheduler)
.ObserveOn(RxSchedulers.MainThreadScheduler)
.Subscribe(_ => StorageUI())
.DisposeWith(disposables);
});
@ -65,7 +65,7 @@ public partial class ClashConnectionsView : ReactiveUserControl<ClashConnections
{
ViewModel?.ClashConnectionClose(false);
}
#region UI
private void RestoreUI()

View file

@ -50,6 +50,7 @@
<Separator />
<MenuItem x:Name="menuAddTuicServer" Header="{x:Static resx:ResUI.menuAddTuicServer}" />
<MenuItem x:Name="menuAddAnytlsServer" Header="{x:Static resx:ResUI.menuAddAnytlsServer}" />
<MenuItem x:Name="menuAddNaiveServer" Header="{x:Static resx:ResUI.menuAddNaiveServer}" />
</MenuItem>
<MenuItem Header="{x:Static resx:ResUI.menuSubscription}">

View file

@ -72,6 +72,7 @@ public partial class MainWindow : WindowBase<MainWindowViewModel>
this.BindCommand(ViewModel, vm => vm.AddTuicServerCmd, v => v.menuAddTuicServer).DisposeWith(disposables);
this.BindCommand(ViewModel, vm => vm.AddWireguardServerCmd, v => v.menuAddWireguardServer).DisposeWith(disposables);
this.BindCommand(ViewModel, vm => vm.AddAnytlsServerCmd, v => v.menuAddAnytlsServer).DisposeWith(disposables);
this.BindCommand(ViewModel, vm => vm.AddNaiveServerCmd, v => v.menuAddNaiveServer).DisposeWith(disposables);
this.BindCommand(ViewModel, vm => vm.AddCustomServerCmd, v => v.menuAddCustomServer).DisposeWith(disposables);
this.BindCommand(ViewModel, vm => vm.AddPolicyGroupServerCmd, v => v.menuAddPolicyGroupServer).DisposeWith(disposables);
this.BindCommand(ViewModel, vm => vm.AddProxyChainServerCmd, v => v.menuAddProxyChainServer).DisposeWith(disposables);
@ -128,25 +129,25 @@ public partial class MainWindow : WindowBase<MainWindowViewModel>
AppEvents.SendSnackMsgRequested
.AsObservable()
.ObserveOn(RxApp.MainThreadScheduler)
.ObserveOn(RxSchedulers.MainThreadScheduler)
.Subscribe(async content => await DelegateSnackMsg(content))
.DisposeWith(disposables);
AppEvents.AppExitRequested
.AsObservable()
.ObserveOn(RxApp.MainThreadScheduler)
.ObserveOn(RxSchedulers.MainThreadScheduler)
.Subscribe(_ => StorageUI())
.DisposeWith(disposables);
AppEvents.ShutdownRequested
.AsObservable()
.ObserveOn(RxApp.MainThreadScheduler)
.ObserveOn(RxSchedulers.MainThreadScheduler)
.Subscribe(content => Shutdown(content))
.DisposeWith(disposables);
AppEvents.ShowHideWindowRequested
.AsObservable()
.ObserveOn(RxApp.MainThreadScheduler)
.ObserveOn(RxSchedulers.MainThreadScheduler)
.Subscribe(blShow => ShowHideWindow(blShow))
.DisposeWith(disposables);
});

View file

@ -410,19 +410,6 @@
Margin="{StaticResource Margin4}"
HorizontalAlignment="Left" />
<TextBlock
Grid.Row="6"
Grid.Column="0"
Margin="{StaticResource Margin4}"
VerticalAlignment="Center"
Text="{x:Static resx:ResUI.TbSettingsEnableUpdateSubOnlyRemarksExist}" />
<ToggleSwitch
x:Name="togEnableUpdateSubOnlyRemarksExist"
Grid.Row="6"
Grid.Column="1"
Margin="{StaticResource Margin4}"
HorizontalAlignment="Left" />
<TextBlock
Grid.Row="8"
Grid.Column="0"

View file

@ -86,7 +86,6 @@ public partial class OptionSettingWindow : WindowBase<OptionSettingViewModel>
this.Bind(ViewModel, vm => vm.DisplayRealTimeSpeed, v => v.togDisplayRealTimeSpeed.IsChecked).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.KeepOlderDedupl, v => v.togKeepOlderDedupl.IsChecked).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.EnableAutoAdjustMainLvColWidth, v => v.togEnableAutoAdjustMainLvColWidth.IsChecked).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.EnableUpdateSubOnlyRemarksExist, v => v.togEnableUpdateSubOnlyRemarksExist.IsChecked).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.AutoHideStartup, v => v.togAutoHideStartup.IsChecked).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.Hide2TrayWhenClose, v => v.togHide2TrayWhenClose.IsChecked).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.MacOSShowInDock, v => v.togMacOSShowInDock.IsChecked).DisposeWith(disposables);

View file

@ -90,13 +90,13 @@ public partial class ProfilesView : ReactiveUserControl<ProfilesViewModel>
AppEvents.AppExitRequested
.AsObservable()
.ObserveOn(RxApp.MainThreadScheduler)
.ObserveOn(RxSchedulers.MainThreadScheduler)
.Subscribe(_ => StorageUI())
.DisposeWith(disposables);
AppEvents.AdjustMainLvColWidthRequested
.AsObservable()
.ObserveOn(RxApp.MainThreadScheduler)
.ObserveOn(RxSchedulers.MainThreadScheduler)
.Subscribe(_ => AutofitColumnWidth())
.DisposeWith(disposables);
});

View file

@ -39,6 +39,11 @@ public partial class App : Application
}
AppManager.Instance.InitComponents();
RxAppBuilder.CreateReactiveUIBuilder()
.WithWpf()
.BuildApp();
base.OnStartup(e);
}

View file

@ -20,6 +20,7 @@ global using System.Windows.Threading;
global using DynamicData;
global using DynamicData.Binding;
global using ReactiveUI;
global using ReactiveUI.Builder;
global using ReactiveUI.Fody.Helpers;
global using ServiceLib;
global using ServiceLib.Base;

View file

@ -277,6 +277,20 @@
Margin="{StaticResource Margin4}"
Style="{StaticResource DefComboBox}" />
<TextBlock
Grid.Row="3"
Grid.Column="0"
Margin="{StaticResource Margin4}"
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.TbUot}" />
<ToggleButton
x:Name="togUotEnabled3"
Grid.Row="3"
Grid.Column="1"
Margin="{StaticResource Margin4}"
HorizontalAlignment="Left" />
<TextBlock
Grid.Row="4"
Grid.Column="0"
@ -772,13 +786,106 @@
Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.TbId3}" />
<TextBox
x:Name="txtId10"
x:Name="txtId11"
Grid.Row="1"
Grid.Column="1"
Width="400"
Margin="{StaticResource Margin4}"
Style="{StaticResource DefTextBox}" />
</Grid>
<Grid
x:Name="gridNaive"
Grid.Row="2"
Visibility="Hidden">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="300" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<TextBlock
Grid.Row="1"
Grid.Column="0"
Margin="{StaticResource Margin4}"
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.TbUsername}" />
<TextBox
x:Name="txtId12"
Grid.Row="1"
Grid.Column="1"
Width="400"
Margin="{StaticResource Margin4}"
Style="{StaticResource DefTextBox}" />
<TextBlock
Grid.Row="2"
Grid.Column="0"
Margin="{StaticResource Margin4}"
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.TbId3}" />
<TextBox
x:Name="txtSecurity12"
Grid.Row="2"
Grid.Column="1"
Width="400"
Margin="{StaticResource Margin4}"
Style="{StaticResource DefTextBox}" />
<TextBlock
Grid.Row="3"
Grid.Column="0"
Margin="{StaticResource Margin4}"
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.TbInsecureConcurrency}" />
<TextBox
x:Name="txtInsecureConcurrency12"
Grid.Row="3"
Grid.Column="1"
Width="200"
Margin="{StaticResource Margin4}"
HorizontalAlignment="Left"
Style="{StaticResource DefTextBox}" />
<TextBlock
Grid.Row="4"
Grid.Column="0"
Margin="{StaticResource Margin4}"
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.TbHeaderType8}" />
<ComboBox
x:Name="cmbHeaderType12"
Grid.Row="4"
Grid.Column="1"
Width="200"
Margin="{StaticResource Margin4}"
Style="{StaticResource DefComboBox}" />
<TextBlock
Grid.Row="5"
Grid.Column="0"
Margin="{StaticResource Margin4}"
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.TbUot}" />
<ToggleButton
x:Name="togUotEnabled12"
Grid.Row="5"
Grid.Column="1"
Margin="{StaticResource Margin4}"
HorizontalAlignment="Left" />
</Grid>
<Separator
x:Name="sepa2"

View file

@ -89,10 +89,24 @@ public partial class AddServerWindow
case EConfigType.Anytls:
gridAnytls.Visibility = Visibility.Visible;
sepa2.Visibility = Visibility.Collapsed;
gridTransport.Visibility = Visibility.Collapsed;
cmbCoreType.IsEnabled = false;
lstStreamSecurity.Add(Global.StreamSecurityReality);
gridFinalmask.Visibility = Visibility.Collapsed;
break;
case EConfigType.Naive:
gridNaive.Visibility = Visibility.Visible;
cmbCoreType.IsEnabled = false;
gridFinalmask.Visibility = Visibility.Collapsed;
cmbFingerprint.IsEnabled = false;
cmbFingerprint.Text = string.Empty;
cmbAllowInsecure.IsEnabled = false;
cmbAllowInsecure.Text = string.Empty;
cmbHeaderType12.ItemsSource = Global.NaiveCongestionControls;
break;
}
cmbStreamSecurity.ItemsSource = lstStreamSecurity;
@ -117,6 +131,7 @@ public partial class AddServerWindow
case EConfigType.Shadowsocks:
this.Bind(ViewModel, vm => vm.SelectedSource.Password, v => v.txtId3.Text).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.SsMethod, v => v.cmbSecurity3.Text).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.Uot, v => v.togUotEnabled3.IsChecked).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.SelectedSource.MuxEnabled, v => v.togmuxEnabled3.IsChecked).DisposeWith(disposables);
break;
@ -151,7 +166,7 @@ public partial class AddServerWindow
case EConfigType.TUIC:
this.Bind(ViewModel, vm => vm.SelectedSource.Username, v => v.txtId8.Text).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.SelectedSource.Password, v => v.txtSecurity8.Text).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.SelectedSource.HeaderType, v => v.cmbHeaderType8.Text).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.CongestionControl, v => v.cmbHeaderType8.Text).DisposeWith(disposables);
break;
case EConfigType.WireGuard:
@ -163,7 +178,15 @@ public partial class AddServerWindow
break;
case EConfigType.Anytls:
this.Bind(ViewModel, vm => vm.SelectedSource.Password, v => v.txtId10.Text).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.SelectedSource.Password, v => v.txtId11.Text).DisposeWith(disposables);
break;
case EConfigType.Naive:
this.Bind(ViewModel, vm => vm.SelectedSource.Username, v => v.txtId12.Text).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.SelectedSource.Password, v => v.txtSecurity12.Text).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.InsecureConcurrency, v => v.txtInsecureConcurrency12.Text).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.CongestionControl, v => v.cmbHeaderType12.Text).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.Uot, v => v.togUotEnabled12.IsChecked).DisposeWith(disposables);
break;
}
this.Bind(ViewModel, vm => vm.SelectedSource.Network, v => v.cmbNetwork.Text).DisposeWith(disposables);

View file

@ -33,7 +33,7 @@ public partial class ClashConnectionsView
AppEvents.AppExitRequested
.AsObservable()
.ObserveOn(RxApp.MainThreadScheduler)
.ObserveOn(RxSchedulers.MainThreadScheduler)
.Subscribe(_ => StorageUI())
.DisposeWith(disposables);
});

View file

@ -124,6 +124,10 @@
x:Name="menuAddAnytlsServer"
Height="{StaticResource MenuItemHeight}"
Header="{x:Static resx:ResUI.menuAddAnytlsServer}" />
<MenuItem
x:Name="menuAddNaiveServer"
Height="{StaticResource MenuItemHeight}"
Header="{x:Static resx:ResUI.menuAddNaiveServer}" />
</MenuItem>
</Menu>
<Separator />

View file

@ -71,6 +71,7 @@ public partial class MainWindow
this.BindCommand(ViewModel, vm => vm.AddTuicServerCmd, v => v.menuAddTuicServer).DisposeWith(disposables);
this.BindCommand(ViewModel, vm => vm.AddWireguardServerCmd, v => v.menuAddWireguardServer).DisposeWith(disposables);
this.BindCommand(ViewModel, vm => vm.AddAnytlsServerCmd, v => v.menuAddAnytlsServer).DisposeWith(disposables);
this.BindCommand(ViewModel, vm => vm.AddNaiveServerCmd, v => v.menuAddNaiveServer).DisposeWith(disposables);
this.BindCommand(ViewModel, vm => vm.AddCustomServerCmd, v => v.menuAddCustomServer).DisposeWith(disposables);
this.BindCommand(ViewModel, vm => vm.AddPolicyGroupServerCmd, v => v.menuAddPolicyGroupServer).DisposeWith(disposables);
this.BindCommand(ViewModel, vm => vm.AddProxyChainServerCmd, v => v.menuAddProxyChainServer).DisposeWith(disposables);
@ -127,25 +128,25 @@ public partial class MainWindow
AppEvents.SendSnackMsgRequested
.AsObservable()
.ObserveOn(RxApp.MainThreadScheduler)
.ObserveOn(RxSchedulers.MainThreadScheduler)
.Subscribe(async content => await DelegateSnackMsg(content))
.DisposeWith(disposables);
AppEvents.AppExitRequested
.AsObservable()
.ObserveOn(RxApp.MainThreadScheduler)
.ObserveOn(RxSchedulers.MainThreadScheduler)
.Subscribe(_ => StorageUI())
.DisposeWith(disposables);
AppEvents.ShutdownRequested
.AsObservable()
.ObserveOn(RxApp.MainThreadScheduler)
.ObserveOn(RxSchedulers.MainThreadScheduler)
.Subscribe(content => Shutdown(content))
.DisposeWith(disposables);
AppEvents.ShowHideWindowRequested
.AsObservable()
.ObserveOn(RxApp.MainThreadScheduler)
.ObserveOn(RxSchedulers.MainThreadScheduler)
.Subscribe(blShow => ShowHideWindow(blShow))
.DisposeWith(disposables);
});

View file

@ -630,20 +630,6 @@
Margin="{StaticResource Margin8}"
HorizontalAlignment="Left" />
<TextBlock
Grid.Row="6"
Grid.Column="0"
Margin="{StaticResource Margin8}"
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.TbSettingsEnableUpdateSubOnlyRemarksExist}" />
<ToggleButton
x:Name="togEnableUpdateSubOnlyRemarksExist"
Grid.Row="6"
Grid.Column="1"
Margin="{StaticResource Margin8}"
HorizontalAlignment="Left" />
<TextBlock
Grid.Row="8"
Grid.Column="0"

View file

@ -91,7 +91,6 @@ public partial class OptionSettingWindow
this.Bind(ViewModel, vm => vm.DisplayRealTimeSpeed, v => v.togDisplayRealTimeSpeed.IsChecked).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.KeepOlderDedupl, v => v.togKeepOlderDedupl.IsChecked).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.EnableAutoAdjustMainLvColWidth, v => v.togEnableAutoAdjustMainLvColWidth.IsChecked).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.EnableUpdateSubOnlyRemarksExist, v => v.togEnableUpdateSubOnlyRemarksExist.IsChecked).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.AutoHideStartup, v => v.togAutoHideStartup.IsChecked).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.EnableDragDropSort, v => v.togEnableDragDropSort.IsChecked).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.DoubleClick2Activate, v => v.togDoubleClick2Activate.IsChecked).DisposeWith(disposables);

View file

@ -97,8 +97,7 @@ public partial class ProfilesSelectWindow
private void LstProfiles_ColumnHeader_Click(object sender, RoutedEventArgs e)
{
var colHeader = sender as DataGridColumnHeader;
if (colHeader == null || colHeader.TabIndex < 0 || colHeader.Column == null)
if (sender is not DataGridColumnHeader colHeader || colHeader.TabIndex < 0 || colHeader.Column == null)
{
return;
}

View file

@ -84,13 +84,13 @@ public partial class ProfilesView
AppEvents.AppExitRequested
.AsObservable()
.ObserveOn(RxApp.MainThreadScheduler)
.ObserveOn(RxSchedulers.MainThreadScheduler)
.Subscribe(_ => StorageUI())
.DisposeWith(disposables);
AppEvents.AdjustMainLvColWidthRequested
.AsObservable()
.ObserveOn(RxApp.MainThreadScheduler)
.ObserveOn(RxSchedulers.MainThreadScheduler)
.Subscribe(_ => AutofitColumnWidth())
.DisposeWith(disposables);
});
@ -233,8 +233,7 @@ public partial class ProfilesView
private void LstProfiles_ColumnHeader_Click(object sender, RoutedEventArgs e)
{
var colHeader = sender as DataGridColumnHeader;
if (colHeader == null || colHeader.TabIndex < 0 || colHeader.Column == null)
if (sender is not DataGridColumnHeader colHeader || colHeader.TabIndex < 0 || colHeader.Column == null)
{
return;
}

View file

@ -2,7 +2,7 @@
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net8.0-windows10.0.17763</TargetFramework>
<TargetFramework>net8.0-windows10.0.19041.0</TargetFramework>
<GenerateSatelliteAssembliesForCore>true</GenerateSatelliteAssembliesForCore>
<UseWPF>true</UseWPF>
<ApplicationIcon>Resources\v2rayN.ico</ApplicationIcon>