mirror of
https://github.com/asdlokj1qpi233/subconverter.git
synced 2025-10-25 18:32:22 +00:00
Compare commits
13 Commits
3ea867e4b8
...
3971468034
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3971468034 | ||
|
|
75a7b1c84c | ||
|
|
4ee3e11950 | ||
|
|
68f2f3bb56 | ||
|
|
79b2e31096 | ||
|
|
d5e6159fbd | ||
|
|
eec5113947 | ||
|
|
695f5eb6d7 | ||
|
|
a0ad2b46e0 | ||
|
|
2b0011a127 | ||
|
|
f69597efb7 | ||
|
|
ffbd262aae | ||
|
|
292850818a |
172
.github/workflows/build.yml
vendored
172
.github/workflows/build.yml
vendored
@@ -1,5 +1,5 @@
|
||||
name: GitHub CI
|
||||
on:
|
||||
on:
|
||||
push:
|
||||
branches: [ master ]
|
||||
tags:
|
||||
@@ -7,7 +7,7 @@ on:
|
||||
workflow_dispatch:
|
||||
pull_request:
|
||||
|
||||
concurrency:
|
||||
concurrency:
|
||||
group: ${{ github.ref }}-${{ github.workflow }}
|
||||
cancel-in-progress: true
|
||||
|
||||
@@ -31,29 +31,29 @@ jobs:
|
||||
runs-on: ${{ matrix.os }}
|
||||
name: Linux ${{ matrix.arch }} Build
|
||||
steps:
|
||||
- name: Checkout base
|
||||
uses: actions/checkout@v4
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v3
|
||||
- name: Add commit id into version
|
||||
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
|
||||
run: SHA=$(git rev-parse --short HEAD) && sed -i 's/\(v[0-9]\.[0-9]\.[0-9]\)/\1-'"$SHA"'/' src/version.h
|
||||
- name: Build
|
||||
run: docker run --rm -v $GITHUB_WORKSPACE:/root/workdir multiarch/alpine:${{ matrix.arch }}-latest-stable /bin/sh -c "apk add bash git nodejs npm && cd /root/workdir && chmod +x scripts/build.alpine.release.sh && bash scripts/build.alpine.release.sh"
|
||||
- name: Upload
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{ matrix.artifact }}
|
||||
path: subconverter/
|
||||
- name: Package Release
|
||||
if: ${{ github.event_name != 'pull_request' && startsWith(github.ref, 'refs/tags/') }}
|
||||
run: tar czf ${{ matrix.artifact }}.tar.gz subconverter
|
||||
- name: Draft Release
|
||||
if: ${{ github.event_name != 'pull_request' && startsWith(github.ref, 'refs/tags/') }}
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
files: ${{ matrix.artifact }}.tar.gz
|
||||
draft: true
|
||||
- name: Checkout base
|
||||
uses: actions/checkout@v4
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v3
|
||||
- name: Add commit id into version
|
||||
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
|
||||
run: SHA=$(git rev-parse --short HEAD) && sed -i 's/\(v[0-9]\.[0-9]\.[0-9]\)/\1-'"$SHA"'/' src/version.h
|
||||
- name: Build
|
||||
run: docker run --rm -v $GITHUB_WORKSPACE:/root/workdir multiarch/alpine:${{ matrix.arch }}-latest-stable /bin/sh -c "apk add bash git nodejs npm && cd /root/workdir && chmod +x scripts/build.alpine.release.sh && bash scripts/build.alpine.release.sh"
|
||||
- name: Upload
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{ matrix.artifact }}
|
||||
path: subconverter/
|
||||
- name: Package Release
|
||||
if: ${{ github.event_name != 'pull_request' && startsWith(github.ref, 'refs/tags/') }}
|
||||
run: tar czf ${{ matrix.artifact }}.tar.gz subconverter
|
||||
- name: Draft Release
|
||||
if: ${{ github.event_name != 'pull_request' && startsWith(github.ref, 'refs/tags/') }}
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
files: ${{ matrix.artifact }}.tar.gz
|
||||
draft: true
|
||||
|
||||
macos_build:
|
||||
strategy:
|
||||
@@ -68,31 +68,31 @@ jobs:
|
||||
runs-on: ${{ matrix.os }}
|
||||
name: macOS ${{ matrix.arch }} Build
|
||||
steps:
|
||||
- name: Checkout base
|
||||
uses: actions/checkout@v4
|
||||
- name: Setup Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.11'
|
||||
- name: Add commit id into version
|
||||
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
|
||||
run: SHA=$(git rev-parse --short HEAD) && sed -i -e 's/\(v[0-9]\.[0-9]\.[0-9]\)/\1-'"$SHA"'/' src/version.h
|
||||
- name: Build
|
||||
run: bash scripts/build.macos.release.sh
|
||||
- name: Upload
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{ matrix.artifact }}
|
||||
path: subconverter/
|
||||
- name: Package Release
|
||||
if: ${{ github.event_name != 'pull_request' && startsWith(github.ref, 'refs/tags/') }}
|
||||
run: tar czf ${{ matrix.artifact }}.tar.gz subconverter
|
||||
- name: Draft Release
|
||||
if: ${{ github.event_name != 'pull_request' && startsWith(github.ref, 'refs/tags/') }}
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
files: ${{ matrix.artifact }}.tar.gz
|
||||
draft: true
|
||||
- name: Checkout base
|
||||
uses: actions/checkout@v4
|
||||
- name: Setup Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.11'
|
||||
- name: Add commit id into version
|
||||
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
|
||||
run: SHA=$(git rev-parse --short HEAD) && sed -i -e 's/\(v[0-9]\.[0-9]\.[0-9]\)/\1-'"$SHA"'/' src/version.h
|
||||
- name: Build
|
||||
run: bash scripts/build.macos.release.sh
|
||||
- name: Upload
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{ matrix.artifact }}
|
||||
path: subconverter/
|
||||
- name: Package Release
|
||||
if: ${{ github.event_name != 'pull_request' && startsWith(github.ref, 'refs/tags/') }}
|
||||
run: tar czf ${{ matrix.artifact }}.tar.gz subconverter
|
||||
- name: Draft Release
|
||||
if: ${{ github.event_name != 'pull_request' && startsWith(github.ref, 'refs/tags/') }}
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
files: ${{ matrix.artifact }}.tar.gz
|
||||
draft: true
|
||||
|
||||
windows_build:
|
||||
strategy:
|
||||
@@ -112,39 +112,39 @@ jobs:
|
||||
run:
|
||||
shell: msys2 {0}
|
||||
steps:
|
||||
- name: Checkout base
|
||||
uses: actions/checkout@v4
|
||||
- name: Setup Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.11'
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '16'
|
||||
- name: Setup MSYS2
|
||||
uses: msys2/setup-msys2@v2
|
||||
with:
|
||||
update: true
|
||||
install: base-devel git mingw-w64-${{ matrix.env }}-gcc mingw-w64-${{ matrix.env }}-cmake mingw-w64-${{ matrix.env }}-pcre2 patch
|
||||
msystem: ${{ matrix.msystem }}
|
||||
path-type: inherit
|
||||
- name: Add commit id into version
|
||||
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
|
||||
run: SHA=$(git rev-parse --short HEAD) && sed -i 's/\(v[0-9]\.[0-9]\.[0-9]\)/\1-'"$SHA"'/' src/version.h
|
||||
- name: Build
|
||||
run: bash scripts/build.windows.release.sh
|
||||
- name: Upload
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{ matrix.artifact }}
|
||||
path: subconverter/
|
||||
- name: Package Release
|
||||
if: ${{ github.event_name != 'pull_request' && startsWith(github.ref, 'refs/tags/') }}
|
||||
run: 7z a ${{ matrix.artifact }}.7z subconverter/
|
||||
- name: Draft Release
|
||||
if: ${{ github.event_name != 'pull_request' && startsWith(github.ref, 'refs/tags/') }}
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
files: ${{ matrix.artifact }}.7z
|
||||
draft: true
|
||||
- name: Checkout base
|
||||
uses: actions/checkout@v4
|
||||
- name: Setup Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.11'
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '16'
|
||||
- name: Setup MSYS2
|
||||
uses: msys2/setup-msys2@v2
|
||||
with:
|
||||
update: true
|
||||
install: base-devel git mingw-w64-${{ matrix.env }}-gcc mingw-w64-${{ matrix.env }}-cmake mingw-w64-${{ matrix.env }}-pcre2 patch
|
||||
msystem: ${{ matrix.msystem }}
|
||||
path-type: inherit
|
||||
- name: Add commit id into version
|
||||
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
|
||||
run: SHA=$(git rev-parse --short HEAD) && sed -i 's/\(v[0-9]\.[0-9]\.[0-9]\)/\1-'"$SHA"'/' src/version.h
|
||||
- name: Build
|
||||
run: bash scripts/build.windows.release.sh
|
||||
- name: Upload
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{ matrix.artifact }}
|
||||
path: subconverter/
|
||||
- name: Package Release
|
||||
if: ${{ github.event_name != 'pull_request' && startsWith(github.ref, 'refs/tags/') }}
|
||||
run: 7z a ${{ matrix.artifact }}.7z subconverter/
|
||||
- name: Draft Release
|
||||
if: ${{ github.event_name != 'pull_request' && startsWith(github.ref, 'refs/tags/') }}
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
files: ${{ matrix.artifact }}.7z
|
||||
draft: true
|
||||
@@ -4,6 +4,10 @@ CMAKE_MINIMUM_REQUIRED(VERSION 3.4)
|
||||
SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/")
|
||||
INCLUDE_DIRECTORIES("${CMAKE_SOURCE_DIR}/include/")
|
||||
|
||||
if (WIN32)
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--allow-multiple-definition")
|
||||
endif()
|
||||
|
||||
IF(NOT CMAKE_BUILD_TYPE)
|
||||
SET(CMAKE_BUILD_TYPE Release)
|
||||
ENDIF()
|
||||
|
||||
@@ -16,8 +16,26 @@ cd ..
|
||||
git clone https://github.com/ftk/quickjspp --depth=1
|
||||
cd quickjspp
|
||||
patch quickjs/quickjs-libc.c -i ../scripts/patches/0001-quickjs-libc-add-realpath-for-Windows.patch
|
||||
cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release .
|
||||
cmake -G "Unix Makefiles" \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_C_FLAGS="-D__MINGW_FENV_DEFINED" .
|
||||
make quickjs -j4
|
||||
# 如果是 32 位编译,则处理 libquickjs.a,去掉重复定义的符号
|
||||
# 注意:此处通过检测目标架构环境变量,你也可以根据实际情况加个判断
|
||||
echo "处理 32 位 libquickjs.a,去除重复定义的符号..."
|
||||
mkdir -p tmp_lib
|
||||
cd tmp_lib
|
||||
# 解包静态库
|
||||
ar x ../quickjs/libquickjs.a
|
||||
# 对每个目标文件,删除这几个符号
|
||||
for obj in *.o; do
|
||||
objcopy --strip-symbol=__mingw_fe_pc53_env --strip-symbol=__mingw_fe_pc64_env --strip-symbol=__mingw_fe_dfl_env "$obj"
|
||||
done
|
||||
# 重新打包为新的静态库
|
||||
ar rcs ../quickjs/libquickjs_fixed.a *.o
|
||||
cd ..
|
||||
# 用处理后的库覆盖原库(或直接安装新库)
|
||||
mv quickjs/libquickjs_fixed.a quickjs/libquickjs.a
|
||||
install -d "$MINGW_PREFIX/lib/quickjs/"
|
||||
install -m644 quickjs/libquickjs.a "$MINGW_PREFIX/lib/quickjs/"
|
||||
install -d "$MINGW_PREFIX/include/quickjs"
|
||||
@@ -54,4 +72,4 @@ make -j4
|
||||
rm subconverter.exe
|
||||
# shellcheck disable=SC2046
|
||||
g++ $(find CMakeFiles/subconverter.dir/src -name "*.obj") curl/lib/libcurl.a -o base/subconverter.exe -static -lbcrypt -lpcre2-8 -l:quickjs/libquickjs.a -llibcron -lyaml-cpp -liphlpapi -lcrypt32 -lws2_32 -lwsock32 -lz -s
|
||||
mv base subconverter
|
||||
mv base subconverter
|
||||
@@ -10,7 +10,9 @@
|
||||
|
||||
/// rule type lists
|
||||
#define basic_types "DOMAIN", "DOMAIN-SUFFIX", "DOMAIN-KEYWORD", "IP-CIDR", "SRC-IP-CIDR", "GEOIP", "MATCH", "FINAL"
|
||||
string_array ClashRuleTypes = {basic_types, "IP-CIDR6", "SRC-PORT", "DST-PORT", "PROCESS-NAME"};
|
||||
// 新增meta路由规则
|
||||
//string_array ClashRuleTypes = {basic_types, "IP-CIDR6", "SRC-PORT", "DST-PORT", "PROCESS-NAME"};
|
||||
string_array ClashRuleTypes = {basic_types, "IP-CIDR6", "SRC-PORT", "DST-PORT", "PROCESS-NAME", "DOMAIN-REGEX", "GEOSITE", "IP-SUFFIX", "IP-ASN", "SRC-GEOIP", "SRC-IP-ASN", "SRC-IP-SUFFIX", "IN-PORT", "IN-TYPE", "IN-USER", "IN-NAME", "PROCESS-PATH-REGEX", "PROCESS-PATH", "PROCESS-NAME-REGEX", "UID", "NETWORK", "DSCP", "SUB-RULE", "RULE-SET", "AND", "OR", "NOT"};
|
||||
string_array Surge2RuleTypes = {basic_types, "IP-CIDR6", "USER-AGENT", "URL-REGEX", "PROCESS-NAME", "IN-PORT", "DEST-PORT", "SRC-IP"};
|
||||
string_array SurgeRuleTypes = {basic_types, "IP-CIDR6", "USER-AGENT", "URL-REGEX", "AND", "OR", "NOT", "PROCESS-NAME", "IN-PORT", "DEST-PORT", "SRC-IP"};
|
||||
string_array QuanXRuleTypes = {basic_types, "USER-AGENT", "HOST", "HOST-SUFFIX", "HOST-KEYWORD"};
|
||||
@@ -248,8 +250,26 @@ std::string rulesetToClashStr(YAML::Node &base_rule, std::vector<RulesetContent>
|
||||
strLine.erase(strLine.find("//"));
|
||||
strLine = trimWhitespace(strLine);
|
||||
}
|
||||
strLine = transformRuleToCommon(temp, strLine, rule_group);
|
||||
output_content += " - " + strLine + "\n";
|
||||
|
||||
//AND & OR & NOT
|
||||
if(startsWith(strLine, "AND") || startsWith(strLine, "OR") || startsWith(strLine, "NOT"))
|
||||
{
|
||||
output_content += " - " + strLine + "," + rule_group + "\n";
|
||||
}
|
||||
//SUB-RULE & RULE-SET
|
||||
else if (startsWith(strLine, "SUB-RULE") || startsWith(strLine, "RULE-SET"))
|
||||
{
|
||||
output_content += " - " + strLine + "\n";
|
||||
}
|
||||
else
|
||||
//OTHER
|
||||
{
|
||||
strLine = transformRuleToCommon(temp, strLine, rule_group);
|
||||
output_content += " - " + strLine + "\n";
|
||||
}
|
||||
|
||||
//strLine = transformRuleToCommon(temp, strLine, rule_group);
|
||||
//output_content += " - " + strLine + "\n";
|
||||
total_rules++;
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1583,7 +1583,7 @@ void explodeStdVless(std::string vless, Proxy &node) {
|
||||
remarks = urlDecode(vless.substr(pos + 1));
|
||||
vless.erase(pos);
|
||||
}
|
||||
const std::string stdvless_matcher = R"(^([\da-f]{4}(?:[\da-f]{4}-){4}[\da-f]{12})@\[?([\d\-a-zA-Z:.]+)\]?:(\d+)(?:\/?\?(.*))?$)";
|
||||
const std::string stdvless_matcher = R"(^([\da-fA-F]{8}-[\da-fA-F]{4}-[\da-fA-F]{4}-[\da-fA-F]{4}-[\da-fA-F]{12})@\[?([\d\-a-zA-Z:.]+)\]?:(\d+)(?:\/?\?(.*))?$)";
|
||||
if (regGetMatch(vless, stdvless_matcher, 5, 0, &id, &add, &port, &addition))
|
||||
return;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user