mirror of
https://github.com/2dust/v2rayN.git
synced 2025-10-27 10:40:08 +00:00
Compare commits
No commits in common. "aeddbc1dccf456d5409d58794dc74f115759522a" and "064a04fbadaa2a570ce712c2719cda17cb92f168" have entirely different histories.
aeddbc1dcc
...
064a04fbad
7 changed files with 13 additions and 19 deletions
7
.github/ISSUE_TEMPLATE/01_bug_report.yml
vendored
7
.github/ISSUE_TEMPLATE/01_bug_report.yml
vendored
|
|
@ -3,13 +3,6 @@ description: 在提出问题前请先自行排除服务器端问题和升级到
|
||||||
title: "[Bug]: "
|
title: "[Bug]: "
|
||||||
labels: ["bug"]
|
labels: ["bug"]
|
||||||
body:
|
body:
|
||||||
- type: input
|
|
||||||
id: "os-version"
|
|
||||||
attributes:
|
|
||||||
label: "操作系统和版本"
|
|
||||||
description: "操作系统和版本"
|
|
||||||
validations:
|
|
||||||
required: true
|
|
||||||
- type: input
|
- type: input
|
||||||
id: "expectation"
|
id: "expectation"
|
||||||
attributes:
|
attributes:
|
||||||
|
|
|
||||||
|
|
@ -857,7 +857,7 @@ namespace ServiceLib.Common
|
||||||
private static async Task<string?> GetLinuxUserId()
|
private static async Task<string?> GetLinuxUserId()
|
||||||
{
|
{
|
||||||
var arg = new List<string>() { "-c", "id -u" };
|
var arg = new List<string>() { "-c", "id -u" };
|
||||||
return await GetCliWrapOutput(Global.LinuxBash, arg);
|
return await GetCliWrapOutput("/bin/bash", arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static async Task<string?> SetLinuxChmod(string? fileName)
|
public static async Task<string?> SetLinuxChmod(string? fileName)
|
||||||
|
|
@ -868,14 +868,14 @@ namespace ServiceLib.Common
|
||||||
fileName = fileName.AppendQuotes();
|
fileName = fileName.AppendQuotes();
|
||||||
//File.SetUnixFileMode(fileName, UnixFileMode.UserRead | UnixFileMode.UserWrite | UnixFileMode.UserExecute);
|
//File.SetUnixFileMode(fileName, UnixFileMode.UserRead | UnixFileMode.UserWrite | UnixFileMode.UserExecute);
|
||||||
var arg = new List<string>() { "-c", $"chmod +x {fileName}" };
|
var arg = new List<string>() { "-c", $"chmod +x {fileName}" };
|
||||||
return await GetCliWrapOutput(Global.LinuxBash, arg);
|
return await GetCliWrapOutput("/bin/bash", arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static async Task<string?> GetLinuxFontFamily(string lang)
|
public static async Task<string?> GetLinuxFontFamily(string lang)
|
||||||
{
|
{
|
||||||
// var arg = new List<string>() { "-c", $"fc-list :lang={lang} family" };
|
// var arg = new List<string>() { "-c", $"fc-list :lang={lang} family" };
|
||||||
var arg = new List<string>() { "-c", $"fc-list : family" };
|
var arg = new List<string>() { "-c", $"fc-list : family" };
|
||||||
return await GetCliWrapOutput(Global.LinuxBash, arg);
|
return await GetCliWrapOutput("/bin/bash", arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string? GetHomePath()
|
public static string? GetHomePath()
|
||||||
|
|
@ -888,7 +888,7 @@ namespace ServiceLib.Common
|
||||||
public static async Task<string?> GetListNetworkServices()
|
public static async Task<string?> GetListNetworkServices()
|
||||||
{
|
{
|
||||||
var arg = new List<string>() { "-c", $"networksetup -listallnetworkservices" };
|
var arg = new List<string>() { "-c", $"networksetup -listallnetworkservices" };
|
||||||
return await GetCliWrapOutput(Global.LinuxBash, arg);
|
return await GetCliWrapOutput("/bin/bash", arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion Platform
|
#endregion Platform
|
||||||
|
|
|
||||||
|
|
@ -71,7 +71,6 @@ namespace ServiceLib
|
||||||
public const string V2RayLocalAsset = "V2RAY_LOCATION_ASSET";
|
public const string V2RayLocalAsset = "V2RAY_LOCATION_ASSET";
|
||||||
public const string XrayLocalAsset = "XRAY_LOCATION_ASSET";
|
public const string XrayLocalAsset = "XRAY_LOCATION_ASSET";
|
||||||
public const int SpeedTestPageSize = 1000;
|
public const int SpeedTestPageSize = 1000;
|
||||||
public const string LinuxBash = "/bin/bash";
|
|
||||||
|
|
||||||
public static readonly List<string> IEProxyProtocols =
|
public static readonly List<string> IEProxyProtocols =
|
||||||
[
|
[
|
||||||
|
|
|
||||||
|
|
@ -177,7 +177,7 @@ namespace ServiceLib.Handler
|
||||||
if (File.Exists(launchAgentPath))
|
if (File.Exists(launchAgentPath))
|
||||||
{
|
{
|
||||||
var args = new[] { "-c", $"launchctl unload -w \"{launchAgentPath}\"" };
|
var args = new[] { "-c", $"launchctl unload -w \"{launchAgentPath}\"" };
|
||||||
await Utils.GetCliWrapOutput(Global.LinuxBash, args);
|
await Utils.GetCliWrapOutput("/bin/bash", args);
|
||||||
|
|
||||||
File.Delete(launchAgentPath);
|
File.Delete(launchAgentPath);
|
||||||
}
|
}
|
||||||
|
|
@ -197,7 +197,7 @@ namespace ServiceLib.Handler
|
||||||
await File.WriteAllTextAsync(launchAgentPath, plistContent);
|
await File.WriteAllTextAsync(launchAgentPath, plistContent);
|
||||||
|
|
||||||
var args = new[] { "-c", $"launchctl load -w \"{launchAgentPath}\"" };
|
var args = new[] { "-c", $"launchctl load -w \"{launchAgentPath}\"" };
|
||||||
await Utils.GetCliWrapOutput(Global.LinuxBash, args);
|
await Utils.GetCliWrapOutput("/bin/bash", args);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -380,7 +380,7 @@ namespace ServiceLib.Handler
|
||||||
private async Task<string> CreateLinuxShellFile(string cmdLine, string fileName)
|
private async Task<string> CreateLinuxShellFile(string cmdLine, string fileName)
|
||||||
{
|
{
|
||||||
//Shell scripts
|
//Shell scripts
|
||||||
var shFilePath = Utils.GetBinConfigPath(AppHandler.Instance.IsAdministrator ? "root_" + fileName : fileName);
|
var shFilePath = Utils.GetBinPath(AppHandler.Instance.IsAdministrator ? "root_" + fileName : fileName);
|
||||||
File.Delete(shFilePath);
|
File.Delete(shFilePath);
|
||||||
var sb = new StringBuilder();
|
var sb = new StringBuilder();
|
||||||
sb.AppendLine("#!/bin/sh");
|
sb.AppendLine("#!/bin/sh");
|
||||||
|
|
|
||||||
|
|
@ -116,7 +116,7 @@ namespace ServiceLib.Services.CoreConfig
|
||||||
//enable tun mode
|
//enable tun mode
|
||||||
if (_config.TunModeItem.EnableTun)
|
if (_config.TunModeItem.EnableTun)
|
||||||
{
|
{
|
||||||
var tun = EmbedUtils.GetEmbedText(Global.ClashTunYaml);
|
string tun = EmbedUtils.GetEmbedText(Global.ClashTunYaml);
|
||||||
if (Utils.IsNotEmpty(tun))
|
if (Utils.IsNotEmpty(tun))
|
||||||
{
|
{
|
||||||
var tunContent = YamlUtils.FromYaml<Dictionary<string, object>>(tun);
|
var tunContent = YamlUtils.FromYaml<Dictionary<string, object>>(tun);
|
||||||
|
|
|
||||||
|
|
@ -336,19 +336,21 @@ namespace ServiceLib.Services
|
||||||
ipAddress = ipHostInfo.AddressList.First();
|
ipAddress = ipHostInfo.AddressList.First();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var timer = Stopwatch.StartNew();
|
||||||
|
|
||||||
IPEndPoint endPoint = new(ipAddress, port);
|
IPEndPoint endPoint = new(ipAddress, port);
|
||||||
using Socket clientSocket = new(endPoint.AddressFamily, SocketType.Stream, ProtocolType.Tcp);
|
using Socket clientSocket = new(endPoint.AddressFamily, SocketType.Stream, ProtocolType.Tcp);
|
||||||
|
|
||||||
var timer = Stopwatch.StartNew();
|
|
||||||
var result = clientSocket.BeginConnect(endPoint, null, null);
|
var result = clientSocket.BeginConnect(endPoint, null, null);
|
||||||
if (!result.AsyncWaitHandle.WaitOne(TimeSpan.FromSeconds(5)))
|
if (!result.AsyncWaitHandle.WaitOne(TimeSpan.FromSeconds(5)))
|
||||||
{
|
{
|
||||||
throw new TimeoutException("connect timeout (5s): " + url);
|
throw new TimeoutException("connect timeout (5s): " + url);
|
||||||
}
|
}
|
||||||
timer.Stop();
|
|
||||||
responseTime = (int)timer.Elapsed.TotalMilliseconds;
|
|
||||||
|
|
||||||
clientSocket.EndConnect(result);
|
clientSocket.EndConnect(result);
|
||||||
|
|
||||||
|
timer.Stop();
|
||||||
|
responseTime = (int)timer.Elapsed.TotalMilliseconds;
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue