mirror of
https://github.com/2dust/v2rayN.git
synced 2026-02-28 21:23:04 +00:00
Compare commits
6 commits
b4f9598ae7
...
d0737b1a56
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d0737b1a56 | ||
|
|
d589713fd5 | ||
|
|
4550ddb14e | ||
|
|
ffe401a26d | ||
|
|
8774e302b2 | ||
|
|
df016dd55c |
9 changed files with 105 additions and 14 deletions
65
.github/workflows/build-linux.yml
vendored
65
.github/workflows/build-linux.yml
vendored
|
|
@ -31,7 +31,7 @@ jobs:
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v6.0.1
|
uses: actions/checkout@v6.0.2
|
||||||
with:
|
with:
|
||||||
submodules: 'recursive'
|
submodules: 'recursive'
|
||||||
fetch-depth: '0'
|
fetch-depth: '0'
|
||||||
|
|
@ -103,14 +103,67 @@ jobs:
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Prepare tools (Red Hat)
|
- name: Prepare tools (Red Hat)
|
||||||
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
dnf repolist all
|
set -euo pipefail
|
||||||
dnf -y makecache
|
|
||||||
dnf -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-10.noarch.rpm
|
. /etc/os-release
|
||||||
dnf -y install sudo git rpm-build rpmdevtools dnf-plugins-core rsync findutils tar gzip unzip which
|
EL_MAJOR="${VERSION_ID%%.*}"
|
||||||
|
echo "EL_MAJOR=${EL_MAJOR}"
|
||||||
|
|
||||||
|
dnf -y makecache || true
|
||||||
|
command -v curl >/dev/null || dnf -y install curl ca-certificates
|
||||||
|
|
||||||
|
ARCH="$(uname -m)"
|
||||||
|
case "$ARCH" in x86_64|aarch64) ;; *) echo "Unsupported arch: $ARCH"; exit 1 ;; esac
|
||||||
|
|
||||||
|
install_epel_from_dir() {
|
||||||
|
local base="$1" rpm
|
||||||
|
echo "Try: $base"
|
||||||
|
|
||||||
|
rpm="$(
|
||||||
|
{
|
||||||
|
curl -fsSL "$base/Packages/" 2>/dev/null
|
||||||
|
curl -fsSL "$base/Packages/e/" 2>/dev/null | sed 's|href="|href="e/|'
|
||||||
|
} |
|
||||||
|
sed -n 's/.*href="\([^"]*epel-release-[^"]*\.noarch\.rpm\)".*/\1/p' |
|
||||||
|
sort -V | tail -n1
|
||||||
|
)" || true
|
||||||
|
|
||||||
|
if [[ -n "$rpm" ]]; then
|
||||||
|
dnf -y install "$base/Packages/$rpm"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
FEDORA="https://dl.fedoraproject.org/pub/epel/epel-release-latest-${EL_MAJOR}.noarch.rpm"
|
||||||
|
echo "Try Fedora: $FEDORA"
|
||||||
|
|
||||||
|
if curl -fsSLI "$FEDORA" >/dev/null; then
|
||||||
|
dnf -y install "$FEDORA"
|
||||||
|
else
|
||||||
|
ROCKY="https://dl.rockylinux.org/pub/rocky/${EL_MAJOR}/extras/${ARCH}/os"
|
||||||
|
if install_epel_from_dir "$ROCKY"; then
|
||||||
|
:
|
||||||
|
else
|
||||||
|
ALMA="https://repo.almalinux.org/almalinux/${EL_MAJOR}/extras/${ARCH}/os"
|
||||||
|
if install_epel_from_dir "$ALMA"; then
|
||||||
|
:
|
||||||
|
else
|
||||||
|
echo "EPEL bootstrap failed (Fedora/Rocky/Alma)"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
dnf -y install sudo git rpm-build rpmdevtools dnf-plugins-core \
|
||||||
|
rsync findutils tar gzip unzip which
|
||||||
|
|
||||||
|
dnf repolist | grep -i epel || true
|
||||||
|
|
||||||
- name: Checkout repo (for scripts)
|
- name: Checkout repo (for scripts)
|
||||||
uses: actions/checkout@v6.0.1
|
uses: actions/checkout@v6.0.2
|
||||||
with:
|
with:
|
||||||
submodules: 'recursive'
|
submodules: 'recursive'
|
||||||
fetch-depth: '0'
|
fetch-depth: '0'
|
||||||
|
|
|
||||||
2
.github/workflows/build-osx.yml
vendored
2
.github/workflows/build-osx.yml
vendored
|
|
@ -26,7 +26,7 @@ jobs:
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v6.0.1
|
uses: actions/checkout@v6.0.2
|
||||||
with:
|
with:
|
||||||
submodules: 'recursive'
|
submodules: 'recursive'
|
||||||
fetch-depth: '0'
|
fetch-depth: '0'
|
||||||
|
|
|
||||||
2
.github/workflows/build-windows-desktop.yml
vendored
2
.github/workflows/build-windows-desktop.yml
vendored
|
|
@ -26,7 +26,7 @@ jobs:
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v6.0.1
|
uses: actions/checkout@v6.0.2
|
||||||
with:
|
with:
|
||||||
submodules: 'recursive'
|
submodules: 'recursive'
|
||||||
fetch-depth: '0'
|
fetch-depth: '0'
|
||||||
|
|
|
||||||
2
.github/workflows/build-windows.yml
vendored
2
.github/workflows/build-windows.yml
vendored
|
|
@ -27,7 +27,7 @@ jobs:
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v6.0.1
|
uses: actions/checkout@v6.0.2
|
||||||
|
|
||||||
- name: Setup
|
- name: Setup
|
||||||
uses: actions/setup-dotnet@v5.0.1
|
uses: actions/setup-dotnet@v5.0.1
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
<Project>
|
<Project>
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Version>7.17.1</Version>
|
<Version>7.17.2</Version>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
|
|
|
||||||
|
|
@ -94,4 +94,28 @@ public static class Extension
|
||||||
{
|
{
|
||||||
return configType is EConfigType.Custom or EConfigType.PolicyGroup or EConfigType.ProxyChain;
|
return configType is EConfigType.Custom or EConfigType.PolicyGroup or EConfigType.ProxyChain;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Safely adds elements from a collection to the list. Does nothing if the source is null.
|
||||||
|
/// </summary>
|
||||||
|
public static void AddRangeSafe<T>(this ICollection<T> destination, IEnumerable<T>? source)
|
||||||
|
{
|
||||||
|
ArgumentNullException.ThrowIfNull(destination);
|
||||||
|
|
||||||
|
if (source is null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (destination is List<T> list)
|
||||||
|
{
|
||||||
|
list.AddRange(source);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var item in source)
|
||||||
|
{
|
||||||
|
destination.Add(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -719,10 +719,9 @@ public class Utils
|
||||||
return Guid.TryParse(strSrc, out _);
|
return Guid.TryParse(strSrc, out _);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Dictionary<string, string> GetSystemHosts()
|
private static Dictionary<string, string> GetSystemHosts(string hostFile)
|
||||||
{
|
{
|
||||||
var systemHosts = new Dictionary<string, string>();
|
var systemHosts = new Dictionary<string, string>();
|
||||||
var hostFile = @"C:\Windows\System32\drivers\etc\hosts";
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (File.Exists(hostFile))
|
if (File.Exists(hostFile))
|
||||||
|
|
@ -755,6 +754,19 @@ public class Utils
|
||||||
return systemHosts;
|
return systemHosts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Dictionary<string, string> GetSystemHosts()
|
||||||
|
{
|
||||||
|
var hosts = GetSystemHosts(@"C:\Windows\System32\drivers\etc\hosts");
|
||||||
|
var hostsIcs = GetSystemHosts(@"C:\Windows\System32\drivers\etc\hosts.ics");
|
||||||
|
|
||||||
|
foreach (var (key, value) in hostsIcs)
|
||||||
|
{
|
||||||
|
hosts[key] = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
return hosts;
|
||||||
|
}
|
||||||
|
|
||||||
public static async Task<string?> GetCliWrapOutput(string filePath, string? arg)
|
public static async Task<string?> GetCliWrapOutput(string filePath, string? arg)
|
||||||
{
|
{
|
||||||
return await GetCliWrapOutput(filePath, arg != null ? new List<string>() { arg } : null);
|
return await GetCliWrapOutput(filePath, arg != null ? new List<string>() { arg } : null);
|
||||||
|
|
|
||||||
|
|
@ -218,8 +218,8 @@ public class ActionPrecheckManager
|
||||||
|
|
||||||
var childIds = new List<string>();
|
var childIds = new List<string>();
|
||||||
var subItems = await ProfileGroupItemManager.GetSubChildProfileItems(group);
|
var subItems = await ProfileGroupItemManager.GetSubChildProfileItems(group);
|
||||||
childIds.AddRange(subItems.Select(p => p.IndexId));
|
childIds.AddRangeSafe(subItems.Select(p => p.IndexId));
|
||||||
childIds.AddRange(Utils.String2List(group.ChildItems));
|
childIds.AddRangeSafe(Utils.String2List(group.ChildItems));
|
||||||
|
|
||||||
foreach (var child in childIds)
|
foreach (var child in childIds)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -281,7 +281,9 @@ public partial class CoreConfigSingboxService
|
||||||
if (_config.TunModeItem.EnableTun && item.Process?.Count > 0)
|
if (_config.TunModeItem.EnableTun && item.Process?.Count > 0)
|
||||||
{
|
{
|
||||||
var ruleProcName = JsonUtils.DeepCopy(rule3);
|
var ruleProcName = JsonUtils.DeepCopy(rule3);
|
||||||
|
ruleProcName.process_name ??= [];
|
||||||
var ruleProcPath = JsonUtils.DeepCopy(rule3);
|
var ruleProcPath = JsonUtils.DeepCopy(rule3);
|
||||||
|
ruleProcPath.process_path ??= [];
|
||||||
foreach (var process in item.Process)
|
foreach (var process in item.Process)
|
||||||
{
|
{
|
||||||
// sing-box doesn't support this, fall back to process name match
|
// sing-box doesn't support this, fall back to process name match
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue