Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
643547704e | ||
|
|
4717b63775 | ||
|
|
4af148f480 | ||
|
|
a9c59693ee | ||
|
|
9b3ac159c1 | ||
|
|
c03c98157f | ||
|
|
74149b761f | ||
|
|
44cfa2d8dc | ||
|
|
b0fb00d597 | ||
|
|
af3c1dc039 | ||
|
|
ba246e99e8 |
@@ -187,10 +187,7 @@ namespace v2rayN.Handler
|
|||||||
config.mux4SboxItem = new()
|
config.mux4SboxItem = new()
|
||||||
{
|
{
|
||||||
protocol = Global.SingboxMuxs[0],
|
protocol = Global.SingboxMuxs[0],
|
||||||
max_connections = 4,
|
max_connections = 4
|
||||||
min_streams = 4,
|
|
||||||
max_streams = 0,
|
|
||||||
padding = true
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -170,7 +170,7 @@ namespace v2rayN.Handler
|
|||||||
{
|
{
|
||||||
if (_config.tunModeItem.mtu <= 0)
|
if (_config.tunModeItem.mtu <= 0)
|
||||||
{
|
{
|
||||||
_config.tunModeItem.mtu = Convert.ToInt32(Global.TunMtus[0]);
|
_config.tunModeItem.mtu = Utils.ToInt(Global.TunMtus[0]);
|
||||||
}
|
}
|
||||||
if (Utils.IsNullOrEmpty(_config.tunModeItem.stack))
|
if (Utils.IsNullOrEmpty(_config.tunModeItem.stack))
|
||||||
{
|
{
|
||||||
@@ -294,8 +294,6 @@ namespace v2rayN.Handler
|
|||||||
|
|
||||||
outbound.up_mbps = _config.hysteriaItem.up_mbps > 0 ? _config.hysteriaItem.up_mbps : null;
|
outbound.up_mbps = _config.hysteriaItem.up_mbps > 0 ? _config.hysteriaItem.up_mbps : null;
|
||||||
outbound.down_mbps = _config.hysteriaItem.down_mbps > 0 ? _config.hysteriaItem.down_mbps : null;
|
outbound.down_mbps = _config.hysteriaItem.down_mbps > 0 ? _config.hysteriaItem.down_mbps : null;
|
||||||
|
|
||||||
GenOutboundMux(node, outbound);
|
|
||||||
}
|
}
|
||||||
else if (node.configType == EConfigType.Tuic)
|
else if (node.configType == EConfigType.Tuic)
|
||||||
{
|
{
|
||||||
@@ -304,8 +302,6 @@ namespace v2rayN.Handler
|
|||||||
outbound.uuid = node.id;
|
outbound.uuid = node.id;
|
||||||
outbound.password = node.security;
|
outbound.password = node.security;
|
||||||
outbound.congestion_control = node.headerType;
|
outbound.congestion_control = node.headerType;
|
||||||
|
|
||||||
GenOutboundMux(node, outbound);
|
|
||||||
}
|
}
|
||||||
else if (node.configType == EConfigType.Wireguard)
|
else if (node.configType == EConfigType.Wireguard)
|
||||||
{
|
{
|
||||||
@@ -316,7 +312,6 @@ namespace v2rayN.Handler
|
|||||||
outbound.reserved = Utils.String2List(node.path).Select(int.Parse).ToArray();
|
outbound.reserved = Utils.String2List(node.path).Select(int.Parse).ToArray();
|
||||||
outbound.local_address = [.. Utils.String2List(node.requestHost)];
|
outbound.local_address = [.. Utils.String2List(node.requestHost)];
|
||||||
outbound.mtu = Utils.ToInt(node.shortId.IsNullOrEmpty() ? Global.TunMtus.FirstOrDefault() : node.shortId);
|
outbound.mtu = Utils.ToInt(node.shortId.IsNullOrEmpty() ? Global.TunMtus.FirstOrDefault() : node.shortId);
|
||||||
GenOutboundMux(node, outbound);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GenOutboundTls(node, outbound);
|
GenOutboundTls(node, outbound);
|
||||||
@@ -339,11 +334,8 @@ namespace v2rayN.Handler
|
|||||||
// var mux = new Multiplex4Sbox()
|
// var mux = new Multiplex4Sbox()
|
||||||
// {
|
// {
|
||||||
// enabled = true,
|
// enabled = true,
|
||||||
// protocol = _config.mux4Sbox.protocol,
|
// protocol = _config.mux4SboxItem.protocol,
|
||||||
// max_connections = _config.mux4Sbox.max_connections,
|
// max_connections = _config.mux4SboxItem.max_connections,
|
||||||
// min_streams = _config.mux4Sbox.min_streams,
|
|
||||||
// max_streams = _config.mux4Sbox.max_streams,
|
|
||||||
// padding = _config.mux4Sbox.padding
|
|
||||||
// };
|
// };
|
||||||
// outbound.multiplex = mux;
|
// outbound.multiplex = mux;
|
||||||
//}
|
//}
|
||||||
|
|||||||
@@ -156,7 +156,7 @@ namespace v2rayN.Handler
|
|||||||
|
|
||||||
#region Private
|
#region Private
|
||||||
|
|
||||||
private string CoreFindexe(CoreInfo coreInfo)
|
private string CoreFindExe(CoreInfo coreInfo)
|
||||||
{
|
{
|
||||||
string fileName = string.Empty;
|
string fileName = string.Empty;
|
||||||
foreach (string name in coreInfo.coreExes)
|
foreach (string name in coreInfo.coreExes)
|
||||||
@@ -266,7 +266,7 @@ namespace v2rayN.Handler
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
string fileName = CoreFindexe(coreInfo);
|
string fileName = CoreFindExe(coreInfo);
|
||||||
if (Utils.IsNullOrEmpty(fileName))
|
if (Utils.IsNullOrEmpty(fileName))
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
@@ -286,6 +286,8 @@ namespace v2rayN.Handler
|
|||||||
StandardErrorEncoding = displayLog ? Encoding.UTF8 : null,
|
StandardErrorEncoding = displayLog ? Encoding.UTF8 : null,
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
var startUpErrorMessage = new StringBuilder();
|
||||||
|
var startUpSuccessful = false;
|
||||||
if (displayLog)
|
if (displayLog)
|
||||||
{
|
{
|
||||||
proc.OutputDataReceived += (sender, e) =>
|
proc.OutputDataReceived += (sender, e) =>
|
||||||
@@ -302,6 +304,11 @@ namespace v2rayN.Handler
|
|||||||
{
|
{
|
||||||
string msg = e.Data + Environment.NewLine;
|
string msg = e.Data + Environment.NewLine;
|
||||||
update(false, msg);
|
update(false, msg);
|
||||||
|
|
||||||
|
if (!startUpSuccessful)
|
||||||
|
{
|
||||||
|
startUpErrorMessage.Append(msg);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -314,7 +321,12 @@ namespace v2rayN.Handler
|
|||||||
|
|
||||||
if (proc.WaitForExit(1000))
|
if (proc.WaitForExit(1000))
|
||||||
{
|
{
|
||||||
throw new Exception(displayLog ? proc.StandardError.ReadToEnd() : "启动进程失败并退出 (Failed to start the process and exited)");
|
proc.CancelErrorRead();
|
||||||
|
throw new Exception(displayLog ? startUpErrorMessage.ToString() : "启动进程失败并退出 (Failed to start the process and exited)");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
startUpSuccessful = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
LazyConfig.Instance.AddProcess(proc.Handle);
|
LazyConfig.Instance.AddProcess(proc.Handle);
|
||||||
|
|||||||
@@ -11,14 +11,25 @@ namespace v2rayN.Handler
|
|||||||
|
|
||||||
public static LazyConfig Instance => _instance.Value;
|
public static LazyConfig Instance => _instance.Value;
|
||||||
|
|
||||||
private int _statePort;
|
private int? _statePort;
|
||||||
public int StatePort { get => _statePort; }
|
|
||||||
private Job _processJob = new();
|
public int StatePort
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (_statePort is null)
|
||||||
|
{
|
||||||
|
_statePort = Utils.GetFreePort();
|
||||||
|
}
|
||||||
|
|
||||||
|
return _statePort.Value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private Job _processJob = new();
|
||||||
|
|
||||||
public LazyConfig()
|
public LazyConfig()
|
||||||
{
|
{
|
||||||
_statePort = Utils.GetFreePort();
|
|
||||||
|
|
||||||
SqliteHelper.Instance.CreateTable<SubItem>();
|
SqliteHelper.Instance.CreateTable<SubItem>();
|
||||||
SqliteHelper.Instance.CreateTable<ProfileItem>();
|
SqliteHelper.Instance.CreateTable<ProfileItem>();
|
||||||
SqliteHelper.Instance.CreateTable<ServerStatItem>();
|
SqliteHelper.Instance.CreateTable<ServerStatItem>();
|
||||||
@@ -68,7 +79,7 @@ namespace v2rayN.Handler
|
|||||||
}
|
}
|
||||||
return localPort;
|
return localPort;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddProcess(IntPtr processHandle)
|
public void AddProcess(IntPtr processHandle)
|
||||||
{
|
{
|
||||||
_processJob.AddProcess(processHandle);
|
_processJob.AddProcess(processHandle);
|
||||||
@@ -339,7 +350,7 @@ namespace v2rayN.Handler
|
|||||||
{
|
{
|
||||||
coreType = ECoreType.mihomo,
|
coreType = ECoreType.mihomo,
|
||||||
coreExes = new List<string> { $"mihomo-windows-amd64{(Avx2.X64.IsSupported ? "" : "-compatible")}", "mihomo-windows-amd64-compatible", "mihomo-windows-amd64", "mihomo-windows-386", "mihomo", "clash" },
|
coreExes = new List<string> { $"mihomo-windows-amd64{(Avx2.X64.IsSupported ? "" : "-compatible")}", "mihomo-windows-amd64-compatible", "mihomo-windows-amd64", "mihomo-windows-386", "mihomo", "clash" },
|
||||||
arguments = "-f config.yaml",
|
arguments = "-f config.json",
|
||||||
coreUrl = Global.MihomoCoreUrl,
|
coreUrl = Global.MihomoCoreUrl,
|
||||||
coreReleaseApiUrl = Global.MihomoCoreUrl.Replace(Global.GithubUrl, Global.GithubApiUrl),
|
coreReleaseApiUrl = Global.MihomoCoreUrl.Replace(Global.GithubUrl, Global.GithubApiUrl),
|
||||||
match = "Mihomo",
|
match = "Mihomo",
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ namespace v2rayN.Handler
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
await Task.Delay(1000);
|
await Task.Delay(1000);
|
||||||
await _channel.ConnectAsync();
|
if (_channel != null) await _channel.ConnectAsync();
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ namespace v2rayN.Handler
|
|||||||
StartInfo = new ProcessStartInfo
|
StartInfo = new ProcessStartInfo
|
||||||
{
|
{
|
||||||
FileName = "v2rayUpgrade.exe",
|
FileName = "v2rayUpgrade.exe",
|
||||||
Arguments = fileName.AppendQuotes(),
|
Arguments = fileName.AppendQuotes(),
|
||||||
WorkingDirectory = Utils.StartupPath()
|
WorkingDirectory = Utils.StartupPath()
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -392,6 +392,7 @@ namespace v2rayN.Handler
|
|||||||
|
|
||||||
case ECoreType.clash:
|
case ECoreType.clash:
|
||||||
case ECoreType.clash_meta:
|
case ECoreType.clash_meta:
|
||||||
|
case ECoreType.mihomo:
|
||||||
version = Regex.Match(echo, $"v[0-9.]+").Groups[0].Value;
|
version = Regex.Match(echo, $"v[0-9.]+").Groups[0].Value;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -453,6 +454,7 @@ namespace v2rayN.Handler
|
|||||||
}
|
}
|
||||||
case ECoreType.clash:
|
case ECoreType.clash:
|
||||||
case ECoreType.clash_meta:
|
case ECoreType.clash_meta:
|
||||||
|
case ECoreType.mihomo:
|
||||||
{
|
{
|
||||||
curVersion = getCoreVersion(type);
|
curVersion = getCoreVersion(type);
|
||||||
message = string.Format(ResUI.IsLatestCore, type, curVersion);
|
message = string.Format(ResUI.IsLatestCore, type, curVersion);
|
||||||
|
|||||||
@@ -203,9 +203,6 @@ namespace v2rayN.Mode
|
|||||||
{
|
{
|
||||||
public string protocol { get; set; }
|
public string protocol { get; set; }
|
||||||
public int max_connections { get; set; }
|
public int max_connections { get; set; }
|
||||||
public int min_streams { get; set; }
|
|
||||||
public int max_streams { get; set; }
|
|
||||||
public bool padding { get; set; }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[Serializable]
|
[Serializable]
|
||||||
|
|||||||
@@ -139,9 +139,6 @@
|
|||||||
public bool enabled { get; set; }
|
public bool enabled { get; set; }
|
||||||
public string protocol { get; set; }
|
public string protocol { get; set; }
|
||||||
public int max_connections { get; set; }
|
public int max_connections { get; set; }
|
||||||
public int min_streams { get; set; }
|
|
||||||
public int max_streams { get; set; }
|
|
||||||
public bool padding { get; set; }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Utls4Sbox
|
public class Utls4Sbox
|
||||||
|
|||||||
@@ -40,6 +40,7 @@
|
|||||||
<Button
|
<Button
|
||||||
x:Name="btnSave"
|
x:Name="btnSave"
|
||||||
Width="100"
|
Width="100"
|
||||||
|
Click="btnSave_Click"
|
||||||
Content="{x:Static resx:ResUI.TbConfirm}"
|
Content="{x:Static resx:ResUI.TbConfirm}"
|
||||||
Cursor="Hand"
|
Cursor="Hand"
|
||||||
Style="{StaticResource DefButton}" />
|
Style="{StaticResource DefButton}" />
|
||||||
|
|||||||
@@ -512,8 +512,8 @@ namespace v2rayN.Views
|
|||||||
|
|
||||||
private void StorageUI()
|
private void StorageUI()
|
||||||
{
|
{
|
||||||
_config.uiItem.mainWidth = this.Width;
|
_config.uiItem.mainWidth = Utils.ToInt(this.Width);
|
||||||
_config.uiItem.mainHeight = this.Height;
|
_config.uiItem.mainHeight = Utils.ToInt(this.Height);
|
||||||
|
|
||||||
List<ColumnItem> lvColumnItem = new();
|
List<ColumnItem> lvColumnItem = new();
|
||||||
for (int k = 0; k < lstProfiles.Columns.Count; k++)
|
for (int k = 0; k < lstProfiles.Columns.Count; k++)
|
||||||
@@ -522,7 +522,7 @@ namespace v2rayN.Views
|
|||||||
lvColumnItem.Add(new()
|
lvColumnItem.Add(new()
|
||||||
{
|
{
|
||||||
Name = item2.ExName,
|
Name = item2.ExName,
|
||||||
Width = item2.Visibility == Visibility.Visible ? Convert.ToInt32(item2.ActualWidth) : -1,
|
Width = item2.Visibility == Visibility.Visible ? Utils.ToInt(item2.ActualWidth) : -1,
|
||||||
Index = item2.DisplayIndex
|
Index = item2.DisplayIndex
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
<ApplicationIcon>v2rayN.ico</ApplicationIcon>
|
<ApplicationIcon>v2rayN.ico</ApplicationIcon>
|
||||||
<Copyright>Copyright © 2017-2024 (GPLv3)</Copyright>
|
<Copyright>Copyright © 2017-2024 (GPLv3)</Copyright>
|
||||||
<FileVersion>6.35</FileVersion>
|
<FileVersion>6.36</FileVersion>
|
||||||
<SupportedOSPlatformVersion>7.0</SupportedOSPlatformVersion>
|
<SupportedOSPlatformVersion>7.0</SupportedOSPlatformVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user