Compare commits

..

11 Commits

Author SHA1 Message Date
asdlokj1qpi23
322924f24a fix actions issues 2023-12-25 12:44:00 +08:00
asdlokj1qpi23
04a2c24904 fix actions issues 2023-12-25 12:38:55 +08:00
asdlokj1qpi23
e80ce5833c add arm test 2023-12-25 11:33:22 +08:00
asdlokj1qpi23
31ba5373f0 add arm test 2023-12-25 11:10:37 +08:00
asdlokj1qpi23
d3801b7951 add arm test 2023-12-25 11:09:32 +08:00
asdlokj1qpi23
31775a91a8 add arm test 2023-12-25 11:01:34 +08:00
asdlokj1qpi23
af4dd857a8 Revert "fix vless short_id issue.(#1)"
This reverts commit 686f6b3517.
2023-12-25 11:00:27 +08:00
asdlokj1qpi23
686f6b3517 fix vless short_id issue.(#1) 2023-12-25 11:00:02 +08:00
asdlokj1qpi23
ebad0e96f7 fix vless short_id issue.(#1) 2023-12-25 10:51:21 +08:00
asdlokj1qpi23
927c828a27 Hy1 add ports support for clash export. 2023-12-25 10:22:33 +08:00
asdlokj1qpi23
13a372511b Hy1 add ports support. 2023-12-25 10:19:50 +08:00
7 changed files with 220 additions and 205 deletions

View File

@@ -1,7 +1,6 @@
name: GitHub CI
on:
push:
branches: [ master ]
tags:
- '**'
workflow_dispatch:
@@ -62,55 +61,59 @@ jobs:
files: subconverter_linux64.tar.gz
draft: true
# armv7_build:
# name: Linux armv7 Build
# runs-on: [self-hosted, linux, ARM]
# steps:
# - uses: actions/checkout@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:armv7-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@v3
# with:
# name: subconverter_armv7
# path: subconverter/
# - name: Package Release
# if: ${{ github.event_name != 'pull_request' && startsWith(github.ref, 'refs/tags/') }}
# run: tar czf subconverter_armv7.tar.gz subconverter
# - name: Draft Release
# uses: softprops/action-gh-release@v1
# if: ${{ github.event_name != 'pull_request' && startsWith(github.ref, 'refs/tags/') }}
# with:
# files: subconverter_armv7.tar.gz
# draft: true
#
# aarch64_build:
# name: Linux aarch64 Build
# runs-on: [self-hosted, linux, ARM64]
# steps:
# - uses: actions/checkout@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:aarch64-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@v3
# with:
# name: subconverter_aarch64
# path: subconverter/
# - name: Package Release
# if: ${{ github.event_name != 'pull_request' && startsWith(github.ref, 'refs/tags/') }}
# run: tar czf subconverter_aarch64.tar.gz subconverter
# - name: Draft Release
# uses: softprops/action-gh-release@v1
# if: ${{ github.event_name != 'pull_request' && startsWith(github.ref, 'refs/tags/') }}
# with:
# files: subconverter_aarch64.tar.gz
# draft: true
armv7_build:
name: Linux armv7 Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@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: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Build
run: docker run --rm -v $GITHUB_WORKSPACE:/root/workdir multiarch/alpine:armv7-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@v3
with:
name: subconverter_armv7
path: subconverter/
- name: Package Release
if: ${{ github.event_name != 'pull_request' && startsWith(github.ref, 'refs/tags/') }}
run: tar czf subconverter_armv7.tar.gz subconverter
- name: Draft Release
uses: softprops/action-gh-release@v1
if: ${{ github.event_name != 'pull_request' && startsWith(github.ref, 'refs/tags/') }}
with:
files: subconverter_armv7.tar.gz
draft: true
aarch64_build:
name: Linux aarch64 Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@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: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Build
run: docker run --rm -v $GITHUB_WORKSPACE:/root/workdir multiarch/alpine:aarch64-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@v3
with:
name: subconverter_aarch64
path: subconverter/
- name: Package Release
if: ${{ github.event_name != 'pull_request' && startsWith(github.ref, 'refs/tags/') }}
run: tar czf subconverter_aarch64.tar.gz subconverter
- name: Draft Release
uses: softprops/action-gh-release@v1
if: ${{ github.event_name != 'pull_request' && startsWith(github.ref, 'refs/tags/') }}
with:
files: subconverter_aarch64.tar.gz
draft: true
macos_build:
name: macOS Build

View File

@@ -106,7 +106,7 @@ jobs:
with:
platforms: linux/386
context: scripts/
tags: asdlokj1qpi23/subconverter:latest-x86
tags: asdlokj1qpi23/subconverter:latest
build-args: |
SHA=${{ steps.vars.outputs.sha_short }}
outputs: type=image,push=true
@@ -127,7 +127,7 @@ jobs:
with:
platforms: linux/386
context: scripts/
tags: asdlokj1qpi23/subconverter:${{steps.version.outputs.result}}-x86
tags: asdlokj1qpi23/subconverter:${{steps.version.outputs.result}}
outputs: type=image,push=true
- name: Save digest
@@ -144,150 +144,152 @@ jobs:
name: digest_386
path: /tmp/digest.txt
# armv7_build:
# name: Build ARMv7 Image
# runs-on: [self-hosted, linux, ARM]
# steps:
# - name: Checkout base
# uses: actions/checkout@v3
# with:
# fetch-depth: 0
#
# - name: Set up Docker Buildx
# uses: docker/setup-buildx-action@v2
#
# - name: Docker login
# uses: docker/login-action@v2
# with:
# username: ${{ secrets.DOCKER_USERNAME }}
# password: ${{ secrets.DOCKER_PASSWORD }}
#
# - name: Get commit SHA
# id: vars
# run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
#
# - name: Build and export
# id: build
# if: github.ref == 'refs/heads/master'
# uses: docker/build-push-action@v3
# with:
# platforms: linux/arm/v7
# context: scripts/
# tags: asdlokj1qpi23/subconverter:latest-armv7
# build-args: |
# SHA=${{ steps.vars.outputs.sha_short }}
# THREADS=4
# outputs: type=image,push=true
#
# - name: Replace tag without `v`
# if: startsWith(github.ref, 'refs/tags/')
# uses: actions/github-script@v6
# id: version
# with:
# script: |
# return context.payload.ref.replace(/\/?refs\/tags\/v/, '')
# result-encoding: string
#
# - name: Build release and export
# id: build_rel
# if: startsWith(github.ref, 'refs/tags/')
# uses: docker/build-push-action@v3
# with:
# platforms: linux/arm/v7
# context: scripts/
# tags: asdlokj1qpi23/subconverter:${{steps.version.outputs.result}}-armv7
# build-args: |
# THREADS=4
# outputs: type=image,push=true
#
# - name: Save digest
# if: github.ref == 'refs/heads/master'
# run: echo ${{ steps.build.outputs.digest }} > /tmp/digest.txt
#
# - name: Save release digest
# if: startsWith(github.ref, 'refs/tags/')
# run: echo ${{ steps.build_rel.outputs.digest }} > /tmp/digest.txt
#
# - name: Upload artifact
# uses: actions/upload-artifact@v3
# with:
# name: digest_armv7
# path: /tmp/digest.txt
#
# arm64_build:
# name: Build ARM64 Image
# runs-on: [self-hosted, linux, ARM64]
# steps:
# - name: Checkout base
# uses: actions/checkout@v3
# with:
# fetch-depth: 0
#
# - name: Set up Docker Buildx
# uses: docker/setup-buildx-action@v2
#
# - name: Docker login
# uses: docker/login-action@v2
# with:
# username: ${{ secrets.DOCKER_USERNAME }}
# password: ${{ secrets.DOCKER_PASSWORD }}
#
# - name: Get commit SHA
# id: vars
# run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
#
# - name: Build and export
# id: build
# if: github.ref == 'refs/heads/master'
# uses: docker/build-push-action@v3
# with:
# platforms: linux/arm64
# context: scripts/
# tags: asdlokj1qpi23/subconverter:latest-arm64
# build-args: |
# SHA=${{ steps.vars.outputs.sha_short }}
# THREADS=4
# outputs: type=image,push=true
#
# - name: Replace tag without `v`
# if: startsWith(github.ref, 'refs/tags/')
# uses: actions/github-script@v6
# id: version
# with:
# script: |
# return context.payload.ref.replace(/\/?refs\/tags\/v/, '')
# result-encoding: string
#
# - name: Build release and export
# id: build_rel
# if: startsWith(github.ref, 'refs/tags/')
# uses: docker/build-push-action@v3
# with:
# platforms: linux/arm64
# context: scripts/
# tags: asdlokj1qpi23/subconverter:${{steps.version.outputs.result}}-arm64
# build-args: |
# THREADS=4
# outputs: type=image,push=true
#
# - name: Save digest
# if: github.ref == 'refs/heads/master'
# run: echo ${{ steps.build.outputs.digest }} > /tmp/digest.txt
#
# - name: Save release digest
# if: startsWith(github.ref, 'refs/tags/')
# run: echo ${{ steps.build_rel.outputs.digest }} > /tmp/digest.txt
#
# - name: Upload artifact
# uses: actions/upload-artifact@v3
# with:
# name: digest_arm64
# path: /tmp/digest.txt
armv7_build:
name: Build ARMv7 Image
runs-on: ubuntu-latest
steps:
- name: Checkout base
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Docker login
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Get commit SHA
id: vars
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- name: Build and export
id: build
if: github.ref == 'refs/heads/master'
uses: docker/build-push-action@v3
with:
platforms: linux/arm/v7
context: scripts/
tags: asdlokj1qpi23/subconverter:latest
build-args: |
SHA=${{ steps.vars.outputs.sha_short }}
THREADS=4
outputs: type=image,push=true
- name: Replace tag without `v`
if: startsWith(github.ref, 'refs/tags/')
uses: actions/github-script@v6
id: version
with:
script: |
return context.payload.ref.replace(/\/?refs\/tags\/v/, '')
result-encoding: string
- name: Build release and export
id: build_rel
if: startsWith(github.ref, 'refs/tags/')
uses: docker/build-push-action@v3
with:
platforms: linux/arm/v7
context: scripts/
tags: asdlokj1qpi23/subconverter:${{steps.version.outputs.result}}
build-args: |
THREADS=4
outputs: type=image,push=true
- name: Save digest
if: github.ref == 'refs/heads/master'
run: echo ${{ steps.build.outputs.digest }} > /tmp/digest.txt
- name: Save release digest
if: startsWith(github.ref, 'refs/tags/')
run: echo ${{ steps.build_rel.outputs.digest }} > /tmp/digest.txt
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: digest_armv7
path: /tmp/digest.txt
arm64_build:
name: Build ARM64 Image
runs-on: ubuntu-latest
steps:
- name: Checkout base
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Docker login
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Get commit SHA
id: vars
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- name: Build and export
id: build
if: github.ref == 'refs/heads/master'
uses: docker/build-push-action@v3
with:
platforms: linux/arm64
context: scripts/
tags: asdlokj1qpi23/subconverter:latest
build-args: |
SHA=${{ steps.vars.outputs.sha_short }}
THREADS=4
outputs: type=image,push=true
- name: Replace tag without `v`
if: startsWith(github.ref, 'refs/tags/')
uses: actions/github-script@v6
id: version
with:
script: |
return context.payload.ref.replace(/\/?refs\/tags\/v/, '')
result-encoding: string
- name: Build release and export
id: build_rel
if: startsWith(github.ref, 'refs/tags/')
uses: docker/build-push-action@v3
with:
platforms: linux/arm64
context: scripts/
tags: asdlokj1qpi23/subconverter:${{steps.version.outputs.result}}
build-args: |
THREADS=4
outputs: type=image,push=true
- name: Save digest
if: github.ref == 'refs/heads/master'
run: echo ${{ steps.build.outputs.digest }} > /tmp/digest.txt
- name: Save release digest
if: startsWith(github.ref, 'refs/tags/')
run: echo ${{ steps.build_rel.outputs.digest }} > /tmp/digest.txt
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: digest_arm64
path: /tmp/digest.txt
build:
name: Build
# needs: [amd64_build, x86_build, armv7_build, arm64_build]
needs: [amd64_build, x86_build]
needs: [amd64_build, x86_build, armv7_build, arm64_build]
# needs: [amd64_build, x86_build]
runs-on: ubuntu-latest
steps:
- name: Checkout base

View File

@@ -439,8 +439,11 @@ proxyToClash(std::vector<Proxy> &nodes, YAML::Node &yamlnode, const ProxyGroupCo
singleproxy["auth-str"] = x.Auth;
singleproxy["up"] = x.UpMbps;
singleproxy["down"] = x.DownMbps;
if (!tfo.is_undef())
singleproxy["fast-open"] = tfo.get();
if (!x.Ports.empty()) {
singleproxy["ports"] = x.Ports;
}
if (!tfo.is_undef()){
singleproxy["fast-open"] = tfo.get();}
if (!x.FakeType.empty())
singleproxy["protocol"] = x.FakeType;
if (!x.Host.empty())
@@ -2406,8 +2409,12 @@ proxyToSingBox(std::vector<Proxy> &nodes, rapidjson::Document &json, std::vector
if (!x.PublicKey.empty()) {
reality.AddMember("public_key", rapidjson::StringRef(x.PublicKey.c_str()), allocator);
}
auto shortIds = stringArrayToJsonArray(x.Alpn, ",", allocator);
reality.AddMember("short_id", shortIds, allocator);
// auto shortIds = stringArrayToJsonArray(x.ShortId, ",", allocator);
if (!x.ShortId.empty()) {
reality.AddMember("short_id", rapidjson::StringRef(x.ShortId.c_str()), allocator);
} else {
reality.AddMember("short_id", rapidjson::StringRef(""), allocator);
}
tls.AddMember("reality", reality, allocator);
}
}

View File

@@ -109,7 +109,7 @@ struct Proxy {
uint16_t KeepAlive = 0;
String TestUrl;
String ClientId;
String Ports;
String Auth;
String Alpn;
String UpMbps;

View File

@@ -158,7 +158,7 @@ void wireguardConstruct(Proxy &node, const std::string &group, const std::string
void hysteriaConstruct(Proxy &node, const std::string &group, const std::string &remarks, const std::string &add,
const std::string &port, const std::string &type, const std::string &auth,const std::string &auth_str,
const std::string &host, const std::string &up, const std::string &down, const std::string &alpn,
const std::string &obfsParam, const std::string &insecure, tribool udp, tribool tfo, tribool scv,
const std::string &obfsParam, const std::string &insecure,const std::string &ports, tribool udp, tribool tfo, tribool scv,
tribool tls13) {
commonConstruct(node, ProxyType::Hysteria, group, remarks, add, port, udp, tfo, scv, tls13);
node.Auth = auth;
@@ -170,6 +170,7 @@ void hysteriaConstruct(Proxy &node, const std::string &group, const std::string
node.Insecure = insecure;
node.FakeType = type;
node.AuthStr = auth_str;
node.Ports = ports;
}
@@ -858,6 +859,7 @@ void explodeVless(std::string vless, Proxy &node) {
void explodeHysteria(std::string hysteria, Proxy &node) {
printf("explodeHysteria\n");
hysteria = regReplace(hysteria, "(hysteria|hy)://", "hysteria://");
if (regMatch(hysteria, "hysteria://(.*?)[:](.*)")) {
explodeStdHysteria(hysteria, node);
return;
@@ -1040,7 +1042,7 @@ void explodeNetch(std::string netch, Proxy &node) {
}
void explodeClash(Node yamlnode, std::vector<Proxy> &nodes) {
std::string proxytype, ps, server, port, cipher, group, password = "", tempPassword; //common
std::string proxytype, ps, server, port, cipher, group, password = "",ports, tempPassword; //common
std::string type = "none", id, aid = "0", net = "tcp", path, host, edge, tls, sni; //vmess
std::string fp = "chrome", pbk, sid; //vless
std::string plugin, pluginopts, pluginopts_mode, pluginopts_host, pluginopts_mux; //ss
@@ -1318,8 +1320,9 @@ void explodeClash(Node yamlnode, std::vector<Proxy> &nodes) {
singleproxy["sni"] >> host;
singleproxy["alpn"][0] >> alpn;
singleproxy["protocol"] >> insecure;
singleproxy["ports"] >> ports;
hysteriaConstruct(node, group, ps, server, port, type, auth,"", host, up, down, alpn, obfsParam, insecure,
hysteriaConstruct(node, group, ps, server, port, type, auth,"", host, up, down, alpn, obfsParam, insecure, ports,
udp, tfo, scv);
break;
case "hysteria2"_hash:
@@ -1415,7 +1418,7 @@ void explodeStdHysteria(std::string hysteria, Proxy &node) {
remarks = add + ":" + port;
hysteriaConstruct(node, HYSTERIA_DEFAULT_GROUP, remarks, add, port, type, auth,auth_str, host, up, down, alpn, obfsParam,
insecure);
insecure,"");
return;
}
@@ -2460,7 +2463,7 @@ void explode(const std::string &link, Proxy &node) {
explodeTrojan(link, node);
else if (strFind(link, "vless://") || strFind(link, "vless1://"))
explodeVless(link, node);
else if (strFind(link, "hysteria://"))
else if (strFind(link, "hysteria://") || strFind(link, "hy://"))
explodeHysteria(link, node);
else if (strFind(link, "hysteria2://") || strFind(link, "hy2://"))
explodeHysteria2(link, node);

View File

@@ -19,7 +19,7 @@ enum class ConfType
SUB,
Local
};
void hysteriaConstruct(Proxy &node, const std::string &group, const std::string &remarks, const std::string &add, const std::string &port, const std::string &type, const std::string &auth, const std::string &auth_str, const std::string &host, const std::string &up, const std::string &down, const std::string &alpn, const std::string &obfsParam, const std::string &insecure ,tribool udp = tribool(), tribool tfo = tribool(), tribool scv = tribool(), tribool tls13 = tribool());
void hysteriaConstruct(Proxy &node, const std::string &group, const std::string &remarks, const std::string &add, const std::string &port, const std::string &type, const std::string &auth, const std::string &auth_str, const std::string &host, const std::string &up, const std::string &down, const std::string &alpn, const std::string &obfsParam, const std::string &insecure,const std::string &ports,tribool udp = tribool(), tribool tfo = tribool(), tribool scv = tribool(), tribool tls13 = tribool());
void hysteria2Construct(Proxy &node, const std::string &group, const std::string &remarks, const std::string &add, const std::string &port, const std::string &password, const std::string &host, const std::string &up, const std::string &down, const std::string &alpn, const std::string &obfsParam, const std::string &obfsPassword, const std::string &insecure ,tribool udp = tribool(), tribool tfo = tribool(), tribool scv = tribool(), tribool tls13 = tribool());
void vlessConstruct(Proxy &node, const std::string &group, const std::string &remarks, const std::string &add, const std::string &port, const std::string &type, const std::string &id, const std::string &aid, const std::string &net, const std::string &cipher, const std::string &flow, const std::string &mode, const std::string &path, const std::string &host, const std::string &edge, const std::string &tls,const std::string &pkd, const std::string &sid, const std::string &fp, tribool udp = tribool(), tribool tfo = tribool(), tribool scv = tribool(), tribool tls13 = tribool());
void vmessConstruct(Proxy &node, const std::string &group, const std::string &remarks, const std::string &add, const std::string &port, const std::string &type, const std::string &id, const std::string &aid, const std::string &net, const std::string &cipher, const std::string &path, const std::string &host, const std::string &edge, const std::string &tls, const std::string &sni, tribool udp = tribool(), tribool tfo = tribool(), tribool scv = tribool(), tribool tls13 = tribool());

View File

@@ -1,6 +1,6 @@
#ifndef VERSION_H_INCLUDED
#define VERSION_H_INCLUDED
#define VERSION "v0.9.0"
#define VERSION "v0.9.1"
#endif // VERSION_H_INCLUDED