Compare commits

..

16 Commits
6.16 ... 6.19

Author SHA1 Message Date
2dust
6213f86f81 up 6.19 2023-03-21 17:20:24 +08:00
2dust
0a6955cd59 Add log start core 2023-03-21 14:22:13 +08:00
2dust
6ee8f03ec0 Gui's log can be turned off 2023-03-20 15:25:58 +08:00
2dust
b1a82d95c2 Hide title when title width is equal to 0 2023-03-20 15:23:29 +08:00
2dust
30bc9ded29 Add REALITY share link 2023-03-20 15:20:55 +08:00
2dust
5a32892e94 bug fixes 2023-03-20 14:03:50 +08:00
2dust
e33de896b6 Merge pull request #3507 from ShiinaRinne/dev
Update: 默认关闭硬件加速
2023-03-20 13:23:58 +08:00
ShiinaRinne
3ba92444a5 Update: 默认关闭硬件加速
开启硬件加速时可能会导致奇奇怪怪的问题,因此修改为默认关闭
https://github.com/2dust/v2rayN/issues/3379
https://github.com/2dust/v2rayN/issues/3279
2023-03-18 20:49:02 +08:00
2dust
4f120e8eb4 bug fixes 2023-03-17 17:20:40 +08:00
2dust
08aebf5736 up 6.18 2023-03-17 13:53:14 +08:00
2dust
5a4966ba8d Adjust speed test 2023-03-17 10:32:56 +08:00
2dust
9ba963fc45 bug fixes 2023-03-16 20:11:10 +08:00
2dust
ccc10dbae4 Merge pull request #3493 from ShiinaRinne/AddEnableHWA
Add: 设置中添加"启用硬件加速"的选项
2023-03-16 14:10:20 +08:00
ShiinaRinne
d858342269 Add: 设置中添加"启用硬件加速"的选项 2023-03-15 23:27:51 +08:00
2dust
63f251d1fd up 6.17 2023-03-10 20:38:08 +08:00
2dust
83efe66f3e bug fixes 2023-03-10 11:25:34 +08:00
22 changed files with 165 additions and 93 deletions

View File

@@ -42,10 +42,11 @@ namespace v2rayN
Global.processJob = new Job();
Logging.Setup();
Init();
Logging.LoggingEnabled(_config.guiItem.enableLog);
Utils.SaveLog($"v2rayN start up | {Utils.GetVersion()} | {Utils.GetExePath()}");
Logging.ClearLogs();
Init();
Thread.CurrentThread.CurrentUICulture = new(_config.uiItem.currentLanguage);

View File

@@ -115,7 +115,7 @@ namespace v2rayN.Base
}
}
};
progress.Report("......");
//progress.Report("......");
using var stream = await downloader.DownloadFileTaskAsync(address: url, cancellationToken: cancellationToken.Token);

View File

@@ -956,7 +956,7 @@ namespace v2rayN.Handler
//exist sub items
if (isSub && !Utils.IsNullOrEmpty(subid))
{
var existItem = lstOriSub?.FirstOrDefault(t => CompareProfileItem(t, profileItem, true));
var existItem = lstOriSub?.FirstOrDefault(t => t.isSub == isSub && CompareProfileItem(t, profileItem, true));
if (existItem != null)
{
profileItem.indexId = existItem.indexId;
@@ -972,46 +972,40 @@ namespace v2rayN.Handler
}
profileItem.subid = subid;
profileItem.isSub = isSub;
var addStatus = -1;
if (profileItem.configType == EConfigType.VMess)
{
if (AddServer(ref config, profileItem, false) == 0)
{
countServers++;
}
addStatus = AddServer(ref config, profileItem, false);
}
else if (profileItem.configType == EConfigType.Shadowsocks)
{
if (AddShadowsocksServer(ref config, profileItem, false) == 0)
{
countServers++;
}
addStatus = AddShadowsocksServer(ref config, profileItem, false);
}
else if (profileItem.configType == EConfigType.Socks)
{
if (AddSocksServer(ref config, profileItem, false) == 0)
{
countServers++;
}
addStatus = AddSocksServer(ref config, profileItem, false);
}
else if (profileItem.configType == EConfigType.Trojan)
{
if (AddTrojanServer(ref config, profileItem, false) == 0)
{
countServers++;
}
addStatus = AddTrojanServer(ref config, profileItem, false);
}
else if (profileItem.configType == EConfigType.VLESS)
{
if (AddVlessServer(ref config, profileItem, false) == 0)
{
countServers++;
}
addStatus = AddVlessServer(ref config, profileItem, false);
}
if (addStatus == 0)
{
countServers++;
lstAdd.Add(profileItem);
}
lstAdd.Add(profileItem);
}
SqliteHelper.Instance.InsertAll(lstAdd);
if (lstAdd.Count > 0)
{
SqliteHelper.Instance.InsertAll(lstAdd);
}
ToJsonFile(config);
return countServers;

View File

@@ -458,14 +458,7 @@ namespace v2rayN.Handler
if (node.streamSecurity == Global.StreamSecurityReality)
{
if (Utils.IsNullOrEmpty(node.flow))
{
usersItem.flow = Global.flows[1];
}
else
{
usersItem.flow = node.flow;
}
usersItem.flow = node.flow;
outbound.mux.enabled = false;
outbound.mux.concurrency = -1;
@@ -502,7 +495,7 @@ namespace v2rayN.Handler
serversItem.flow = string.Empty;
serversItem.ota = false;
serversItem.level = 1;
serversItem.level = 1;
outbound.mux.enabled = false;
outbound.mux.concurrency = -1;
@@ -569,7 +562,7 @@ namespace v2rayN.Handler
{
streamSettings.security = node.streamSecurity;
RealitySettings realitySettings = new()
TlsSettings realitySettings = new()
{
fingerprint = node.fingerprint.IsNullOrEmpty() ? config.coreBasicItem.defFingerprint : node.fingerprint,
serverName = sni,
@@ -638,13 +631,6 @@ namespace v2rayN.Handler
}
streamSettings.wsSettings = wsSettings;
//TlsSettings tlsSettings = new TlsSettings();
//tlsSettings.allowInsecure = config.allowInsecure();
//if (!string.IsNullOrWhiteSpace(host))
//{
// tlsSettings.serverName = host;
//}
//streamSettings.tlsSettings = tlsSettings;
break;
//h2
case "h2":
@@ -658,9 +644,6 @@ namespace v2rayN.Handler
streamSettings.httpSettings = httpSettings;
//TlsSettings tlsSettings2 = new TlsSettings();
//tlsSettings2.allowInsecure = config.allowInsecure();
//streamSettings.tlsSettings = tlsSettings2;
break;
//quic
case "quic":
@@ -696,7 +679,6 @@ namespace v2rayN.Handler
permit_without_stream = config.grpcItem.permit_without_stream,
initial_windows_size = config.grpcItem.initial_windows_size,
};
streamSettings.grpcSettings = grpcSettings;
break;
default:

View File

@@ -156,6 +156,7 @@ namespace v2rayN.Handler
if (Utils.IsNullOrEmpty(fileName))
{
string msg = string.Format(ResUI.NotFoundCore, Utils.GetBinPath("", coreInfo.coreType), string.Join(", ", coreInfo.coreExes.ToArray()), coreInfo.coreUrl);
Utils.SaveLog(msg);
ShowMsg(false, msg);
}
return fileName;
@@ -213,6 +214,7 @@ namespace v2rayN.Handler
}
catch (Exception ex)
{
Utils.SaveLog(Utils.ToJson(node));
Utils.SaveLog(ex.Message, ex);
string msg = ex.Message;
ShowMsg(true, msg);

View File

@@ -197,6 +197,18 @@ namespace v2rayN.Handler
{
dicQuery.Add("fp", Utils.UrlEncode(item.fingerprint));
}
if (!Utils.IsNullOrEmpty(item.publicKey))
{
dicQuery.Add("pbk", Utils.UrlEncode(item.publicKey));
}
if (!Utils.IsNullOrEmpty(item.shortId))
{
dicQuery.Add("sid", Utils.UrlEncode(item.shortId));
}
if (!Utils.IsNullOrEmpty(item.spiderX))
{
dicQuery.Add("spx", Utils.UrlEncode(item.spiderX));
}
dicQuery.Add("type", !Utils.IsNullOrEmpty(item.network) ? item.network : "tcp");
@@ -756,6 +768,10 @@ namespace v2rayN.Handler
item.sni = query["sni"] ?? "";
item.alpn = Utils.UrlDecode(query["alpn"] ?? "");
item.fingerprint = Utils.UrlDecode(query["fp"] ?? "");
item.publicKey = Utils.UrlDecode(query["pbk"] ?? "");
item.shortId = Utils.UrlDecode(query["sid"] ?? "");
item.spiderX = Utils.UrlDecode(query["spx"] ?? "");
item.network = query["type"] ?? "tcp";
switch (item.network)
{

View File

@@ -58,11 +58,11 @@ namespace v2rayN.Handler
ProfileExHandler.Instance.SetTestDelay(it.indexId, "0");
break;
case ESpeedActionType.Speedtest:
UpdateFunc(it.indexId, "", ResUI.Speedtesting);
UpdateFunc(it.indexId, "", ResUI.SpeedtestingWait);
ProfileExHandler.Instance.SetTestSpeed(it.indexId, "0");
break;
case ESpeedActionType.Mixedtest:
UpdateFunc(it.indexId, ResUI.Speedtesting, ResUI.Speedtesting);
UpdateFunc(it.indexId, ResUI.Speedtesting, ResUI.SpeedtestingWait);
ProfileExHandler.Instance.SetTestDelay(it.indexId, "0");
ProfileExHandler.Instance.SetTestSpeed(it.indexId, "0");
break;
@@ -236,6 +236,7 @@ namespace v2rayN.Handler
// continue;
//}
ProfileExHandler.Instance.SetTestSpeed(it.indexId, "-1");
UpdateFunc(it.indexId, "", ResUI.Speedtesting);
var item = LazyConfig.Instance.GetProfileItem(it.indexId);
if (item is null) continue;
@@ -287,6 +288,7 @@ namespace v2rayN.Handler
continue;
}
ProfileExHandler.Instance.SetTestSpeed(it.indexId, "-1");
UpdateFunc(it.indexId, "", ResUI.Speedtesting);
var item = LazyConfig.Instance.GetProfileItem(it.indexId);
if (item is null) continue;

View File

@@ -103,6 +103,10 @@ namespace v2rayN.Mode
public bool enableSecurityProtocolTls13 { get; set; }
public int trayMenuServersLimit { get; set; } = 20;
public bool enableHWA { get; set; } = false;
public bool enableLog { get; set; } = true;
}
[Serializable]

View File

@@ -391,7 +391,7 @@ namespace v2rayN.Mode
/// <summary>
/// VLESS only
/// </summary>
public RealitySettings realitySettings { get; set; }
public TlsSettings realitySettings { get; set; }
/// <summary>
/// grpc
/// </summary>
@@ -404,34 +404,24 @@ namespace v2rayN.Mode
/// <summary>
/// 是否允许不安全连接(用于客户端)
/// </summary>
public bool allowInsecure { get; set; }
public bool? allowInsecure { get; set; }
/// <summary>
///
/// </summary>
public string serverName { get; set; }
public string? serverName { get; set; }
/// <summary>
///
/// </summary>
public List<string> alpn
{
get; set;
}
public List<string>? alpn { get; set; }
/// <summary>
/// "chrome" | "firefox" | "safari" | "randomized"
/// </summary>
public string fingerprint { get; set; }
public string? fingerprint { get; set; }
public bool? show { get; set; } = false;
public string? publicKey { get; set; }
public string? shortId { get; set; }
public string? spiderX { get; set; }
}
public class RealitySettings
{
public bool show { get; set; } = false;
public string fingerprint { get; set; }
public string serverName { get; set; }
public string publicKey { get; set; }
public string shortId { get; set; }
public string spiderX { get; set; }
}
public class TcpSettings

View File

@@ -1788,6 +1788,15 @@ namespace v2rayN.Resx {
}
}
/// <summary>
/// 查找类似 Waiting for testing 的本地化字符串。
/// </summary>
public static string SpeedtestingWait {
get {
return ResourceManager.GetString("SpeedtestingWait", resourceCulture);
}
}
/// <summary>
/// 查找类似 PAC failed to start. Please run this program as Administrator. 的本地化字符串。
/// </summary>
@@ -2509,6 +2518,15 @@ namespace v2rayN.Resx {
}
}
/// <summary>
/// 查找类似 Enable hardware acceleration(Require restart) 的本地化字符串。
/// </summary>
public static string TbSettingsEnableHWA {
get {
return ResourceManager.GetString("TbSettingsEnableHWA", resourceCulture);
}
}
/// <summary>
/// 查找类似 Exception 的本地化字符串。
/// </summary>

View File

@@ -1066,4 +1066,7 @@
<data name="TbSettingsDefUserAgentTips" xml:space="preserve">
<value>This parameter is valid only for tcp/http and ws</value>
</data>
<data name="TbSettingsEnableHWA" xml:space="preserve">
<value>فعال‌سازی شتاب‌دهنده سخت‌افزاری (نیاز به راه‌اندازی مجدد)</value>
</data>
</root>

View File

@@ -1141,4 +1141,10 @@
<data name="TbSpiderX" xml:space="preserve">
<value>SpiderX</value>
</data>
<data name="TbSettingsEnableHWA" xml:space="preserve">
<value>Enable hardware acceleration(Require restart)</value>
</data>
<data name="SpeedtestingWait" xml:space="preserve">
<value>Waiting for testing</value>
</data>
</root>

View File

@@ -1108,4 +1108,7 @@
<data name="TbSettingsFontSize" xml:space="preserve">
<value>Размер шрифта</value>
</data>
<data name="TbSettingsEnableHWA" xml:space="preserve">
<value>Включить аппаратное ускорение (требуется перезагрузка)</value>
</data>
</root>

View File

@@ -1141,4 +1141,10 @@
<data name="TbSpiderX" xml:space="preserve">
<value>SpiderX</value>
</data>
<data name="TbSettingsEnableHWA" xml:space="preserve">
<value>启用硬件加速(需重启)</value>
</data>
<data name="SpeedtestingWait" xml:space="preserve">
<value>等待测试中...</value>
</data>
</root>

View File

@@ -17,6 +17,13 @@ namespace v2rayN.Tool
config.LoggingRules.Add(new LoggingRule("*", LogLevel.Debug, fileTarget));
LogManager.Configuration = config;
}
public static void LoggingEnabled(bool enable)
{
if (!enable)
{
LogManager.SuspendLogging();
}
}
public static void ClearLogs()
{

View File

@@ -282,6 +282,8 @@ namespace v2rayN
.Replace(Environment.NewLine, "")
.Replace("\n", "")
.Replace("\r", "")
.Replace('_', '/')
.Replace('-', '+')
.Replace(" ", "");
if (plainText.Length % 4 > 0)
@@ -312,7 +314,7 @@ namespace v2rayN
}
catch (Exception ex)
{
SaveLog(ex.Message, ex);
//SaveLog(ex.Message, ex);
return 0;
}
}
@@ -324,7 +326,7 @@ namespace v2rayN
}
catch (Exception ex)
{
SaveLog(ex.Message, ex);
//SaveLog(ex.Message, ex);
return false;
}
}
@@ -337,7 +339,7 @@ namespace v2rayN
}
catch (Exception ex)
{
SaveLog(ex.Message, ex);
//SaveLog(ex.Message, ex);
return string.Empty;
}
}
@@ -778,7 +780,7 @@ namespace v2rayN
task.Settings.RunOnlyIfIdle = false;
task.Settings.IdleSettings.StopOnIdleEnd = false;
task.Settings.ExecutionTimeLimit = TimeSpan.Zero;
task.Triggers.Add(new LogonTrigger { UserId = logonUser, Delay = TimeSpan.FromMinutes(1) });
task.Triggers.Add(new LogonTrigger { UserId = logonUser, Delay = TimeSpan.FromSeconds(10) });
task.Principal.RunLevel = TaskRunLevel.Highest;
task.Actions.Add(new ExecAction(deamonFileName));
@@ -865,7 +867,7 @@ namespace v2rayN
string location = GetExePath();
if (blFull)
{
return string.Format("v2rayN - V{0} - {1}",
return string.Format("v2rayN - V{0} - {1}-Test",
FileVersionInfo.GetVersionInfo(location).FileVersion.ToString(),
File.GetLastWriteTime(location).ToString("yyyy/MM/dd"));
}
@@ -907,13 +909,13 @@ namespace v2rayN
/// <returns></returns>
public static string? GetClipboardData()
{
string strData = string.Empty;
string? strData = string.Empty;
try
{
IDataObject data = Clipboard.GetDataObject();
if (data.GetDataPresent(DataFormats.UnicodeText))
{
strData = data.GetData(DataFormats.UnicodeText).ToString();
strData = data.GetData(DataFormats.UnicodeText)?.ToString();
}
return strData;
}
@@ -1150,17 +1152,23 @@ namespace v2rayN
public static void SaveLog(string strContent)
{
var logger = LogManager.GetLogger("Log1");
logger.Info(strContent);
if (LogManager.IsLoggingEnabled())
{
var logger = LogManager.GetLogger("Log1");
logger.Info(strContent);
}
}
public static void SaveLog(string strTitle, Exception ex)
{
var logger = LogManager.GetLogger("Log2");
logger.Debug($"{strTitle},{ex.Message}");
logger.Debug(ex.StackTrace);
if (ex?.InnerException != null)
if (LogManager.IsLoggingEnabled())
{
logger.Error(ex.InnerException);
var logger = LogManager.GetLogger("Log2");
logger.Debug($"{strTitle},{ex.Message}");
logger.Debug(ex.StackTrace);
if (ex?.InnerException != null)
{
logger.Error(ex.InnerException);
}
}
}

View File

@@ -700,7 +700,7 @@ namespace v2rayN.ViewModels
_subId = SelectedSub?.id;
_config.subIndexId = _subId;
RefreshServers(false);
RefreshServers();
_updateView("ProfilesFocus");
}
@@ -715,13 +715,12 @@ namespace v2rayN.ViewModels
RefreshServers();
}
private void RefreshServers(bool blCheckDefault = true)
private void RefreshServers()
{
List<ProfileItemModel> lstModel = LazyConfig.Instance.ProfileItems(_subId, _serverFilter);
if (blCheckDefault)
{
ConfigHandler.SetDefaultServer(_config, lstModel);
}
ConfigHandler.SetDefaultServer(_config, lstModel);
List<ServerStatItem> lstServerStat = new();
if (_statistics != null && _statistics.Enable)
{

View File

@@ -65,6 +65,7 @@ namespace v2rayN.ViewModels
[Reactive] public string currentFontFamily { get; set; }
[Reactive] public int SpeedTestTimeout { get; set; }
[Reactive] public string SpeedTestUrl { get; set; }
[Reactive] public bool EnableHWA { get; set; }
#endregion
@@ -160,6 +161,7 @@ namespace v2rayN.ViewModels
currentFontFamily = _config.uiItem.currentFontFamily;
SpeedTestTimeout = _config.speedTestItem.speedTestTimeout;
SpeedTestUrl = _config.speedTestItem.speedTestUrl;
EnableHWA = _config.guiItem.enableHWA;
#endregion
@@ -339,6 +341,7 @@ namespace v2rayN.ViewModels
_config.uiItem.currentFontFamily = currentFontFamily;
_config.speedTestItem.speedTestTimeout = SpeedTestTimeout;
_config.speedTestItem.speedTestUrl = SpeedTestUrl;
_config.guiItem.enableHWA = EnableHWA;
//systemProxy
_config.systemProxyExceptions = systemProxyExceptions;

View File

@@ -197,6 +197,11 @@ namespace v2rayN.Views
{
WindowState = WindowState.Minimized;
}
if (!_config.guiItem.enableHWA)
{
RenderOptions.ProcessRenderMode = RenderMode.SoftwareOnly;
}
}
#region Event
@@ -440,8 +445,15 @@ namespace v2rayN.Views
var item2 = (MyDGTextColumn)lstProfiles.Columns[k];
if (item2.ExName == item.Name)
{
item2.Width = item.Width;
item2.DisplayIndex = i + 1;
if (item.Width <= 0)
{
item2.Visibility = Visibility.Hidden;
}
else
{
item2.Width = item.Width;
item2.DisplayIndex = i + 1;
}
}
}
}
@@ -466,7 +478,7 @@ namespace v2rayN.Views
lvColumnItem.Add(new()
{
Name = item2.ExName,
Width = Convert.ToInt32(item2.ActualWidth),
Width = item2.Visibility == Visibility.Visible ? Convert.ToInt32(item2.ActualWidth) : 0,
Index = item2.DisplayIndex
});
}

View File

@@ -481,6 +481,7 @@
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
@@ -752,6 +753,20 @@
Width="300"
Margin="{StaticResource SettingItemMargin}"
Style="{StaticResource DefComboBox}" />
<TextBlock
Grid.Row="18"
Grid.Column="0"
Margin="{StaticResource SettingItemMargin}"
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.TbSettingsEnableHWA}"/>
<ToggleButton
x:Name="togEnableHWA"
Grid.Row="18"
Grid.Column="1"
Margin="{StaticResource SettingItemMargin}"
HorizontalAlignment="Left" />
</Grid>
</ScrollViewer>
</TabItem>

View File

@@ -164,6 +164,7 @@ namespace v2rayN.Views
this.Bind(ViewModel, vm => vm.currentFontFamily, v => v.cmbcurrentFontFamily.Text).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.SpeedTestTimeout, v => v.cmbSpeedTestTimeout.Text).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.SpeedTestUrl, v => v.cmbSpeedTestUrl.Text).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.EnableHWA, v => v.togEnableHWA.IsChecked).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.systemProxyAdvancedProtocol, v => v.cmbsystemProxyAdvancedProtocol.Text).DisposeWith(disposables);

View File

@@ -10,12 +10,12 @@
<ImplicitUsings>enable</ImplicitUsings>
<ApplicationIcon>v2rayN.ico</ApplicationIcon>
<Copyright>Copyright © 2017-2023 (GPLv3)</Copyright>
<FileVersion>6.16</FileVersion>
<FileVersion>6.19</FileVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Downloader" Version="3.0.3" />
<PackageReference Include="MaterialDesignThemes" Version="4.8.0" />
<PackageReference Include="MaterialDesignThemes" Version="4.7.1" />
<PackageReference Include="Hardcodet.NotifyIcon.Wpf" Version="1.1.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="QRCoder.Xaml" Version="1.4.3" />