From 0ce3d1ad97caa080ac06a5720c66db33638e3a81 Mon Sep 17 00:00:00 2001 From: Alireza Ahmadi Date: Mon, 4 Aug 2025 16:45:21 +0200 Subject: [PATCH 1/4] add dokodemo port map --- web/assets/js/model/inbound.js | 4 ++++ web/html/xui/form/protocol/dokodemo.html | 13 +++++++++++++ web/translation/translate.en_US.toml | 1 + web/translation/translate.fa_IR.toml | 1 + web/translation/translate.ru_RU.toml | 1 + web/translation/translate.vi_VN.toml | 1 + web/translation/translate.zh_Hans.toml | 1 + 7 files changed, 22 insertions(+) diff --git a/web/assets/js/model/inbound.js b/web/assets/js/model/inbound.js index 14570eb1..082b3ced 100644 --- a/web/assets/js/model/inbound.js +++ b/web/assets/js/model/inbound.js @@ -2252,12 +2252,14 @@ Inbound.DokodemoSettings = class extends Inbound.Settings { protocol, address, port, + portMap = [], network = 'tcp,udp', followRedirect = false ) { super(protocol); this.address = address; this.port = port; + this.portMap = portMap; this.network = network; this.followRedirect = followRedirect; } @@ -2267,6 +2269,7 @@ Inbound.DokodemoSettings = class extends Inbound.Settings { Protocols.DOKODEMO, json.address, json.port, + XrayCommonClass.toHeaders(json.portMap), json.network, json.followRedirect, ); @@ -2276,6 +2279,7 @@ Inbound.DokodemoSettings = class extends Inbound.Settings { return { address: this.address, port: this.port, + portMap: XrayCommonClass.toV2Headers(this.portMap), network: this.network, followRedirect: this.followRedirect, }; diff --git a/web/html/xui/form/protocol/dokodemo.html b/web/html/xui/form/protocol/dokodemo.html index f8cc4049..43e6bd46 100644 --- a/web/html/xui/form/protocol/dokodemo.html +++ b/web/html/xui/form/protocol/dokodemo.html @@ -6,6 +6,19 @@ + + + + + + + + + + + - + + + TCP+UDP diff --git a/web/translation/translate.en_US.toml b/web/translation/translate.en_US.toml index 8185cd2e..bb6c91c5 100644 --- a/web/translation/translate.en_US.toml +++ b/web/translation/translate.en_US.toml @@ -123,6 +123,7 @@ "remark" = "Remark" "protocol" = "Protocol" "port" = "Port" +"portMap" = "Port Mapping" "traffic" = "Traffic" "details" = "Details" "transportConfig" = "Transport Config" diff --git a/web/translation/translate.fa_IR.toml b/web/translation/translate.fa_IR.toml index 120d8926..ece7da80 100644 --- a/web/translation/translate.fa_IR.toml +++ b/web/translation/translate.fa_IR.toml @@ -123,6 +123,7 @@ "remark" = "نام" "protocol" = "پروتکل" "port" = "پورت" +"portMap" = "پورت‌های نظیر" "traffic" = "ترافیک" "details" = "جزئیات" "transportConfig" = "نحوه اتصال" diff --git a/web/translation/translate.ru_RU.toml b/web/translation/translate.ru_RU.toml index 8bcd41df..f53d7b01 100644 --- a/web/translation/translate.ru_RU.toml +++ b/web/translation/translate.ru_RU.toml @@ -123,6 +123,7 @@ "remark" = "Примечание" "protocol" = "Протокол" "port" = "Порт" +"portMap" = "Порт-перенаправление" "traffic" = "Трафик" "details" = "Подробнее" "transportConfig" = "Перенести" diff --git a/web/translation/translate.vi_VN.toml b/web/translation/translate.vi_VN.toml index 1a6a2f7b..bf2aef51 100644 --- a/web/translation/translate.vi_VN.toml +++ b/web/translation/translate.vi_VN.toml @@ -123,6 +123,7 @@ "remark" = "Nhận xét" "protocol" = "Giao thức" "port" = "Cổng" +"portMap" = "Cổng điều chính" "traffic" = "Lưu lượng" "details" = "Chi tiết" "transportConfig" = "Cấu hình vận chuyển" diff --git a/web/translation/translate.zh_Hans.toml b/web/translation/translate.zh_Hans.toml index e1201076..d8c26538 100644 --- a/web/translation/translate.zh_Hans.toml +++ b/web/translation/translate.zh_Hans.toml @@ -123,6 +123,7 @@ "remark" = "备注" "protocol" = "协议" "port" = "端口" +"portMap" = "端口映射" "traffic" = "流量" "details" = "详细信息" "transportConfig" = "传输配置" From e752ad75be0eab770540d707dcfe5b98e568f4af Mon Sep 17 00:00:00 2001 From: mhsanaei Date: Mon, 4 Aug 2025 16:47:31 +0200 Subject: [PATCH 2/4] outbound: mldsa65Verify --- web/assets/js/model/outbound.js | 9 +++++++-- web/html/xui/form/outbound.html | 3 +++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/web/assets/js/model/outbound.js b/web/assets/js/model/outbound.js index 279255e1..8f1f24a6 100644 --- a/web/assets/js/model/outbound.js +++ b/web/assets/js/model/outbound.js @@ -392,7 +392,8 @@ class RealityStreamSettings extends CommonClass { fingerprint = '', serverName = '', shortId = '', - spiderX = '/' + spiderX = '', + mldsa65Verify = '' ) { super(); this.publicKey = publicKey; @@ -400,6 +401,7 @@ class RealityStreamSettings extends CommonClass { this.serverName = serverName; this.shortId = shortId this.spiderX = spiderX; + this.mldsa65Verify = mldsa65Verify; } static fromJson(json = {}) { return new RealityStreamSettings( @@ -408,6 +410,7 @@ class RealityStreamSettings extends CommonClass { json.serverName, json.shortId, json.spiderX, + json.mldsa65Verify, ); } toJson() { @@ -417,6 +420,7 @@ class RealityStreamSettings extends CommonClass { serverName: this.serverName, shortId: this.shortId, spiderX: this.spiderX, + mldsa65Verify: this.mldsa65Verify, }; } }; @@ -792,7 +796,8 @@ class Outbound extends CommonClass { let sni = url.searchParams.get('sni') ?? ''; let sid = url.searchParams.get('sid') ?? ''; let spx = url.searchParams.get('spx') ?? ''; - stream.reality = new RealityStreamSettings(pbk, fp, sni, sid, spx); + let pqv = url.searchParams.get('pqv') ?? ''; + stream.reality = new RealityStreamSettings(pbk, fp, sni, sid, spx, pqv); } const regex = /([^@]+):\/\/([^@]+)@(.+):(\d+)(.*)$/; diff --git a/web/html/xui/form/outbound.html b/web/html/xui/form/outbound.html index 536ab697..8c679ebf 100644 --- a/web/html/xui/form/outbound.html +++ b/web/html/xui/form/outbound.html @@ -447,6 +447,9 @@ + + + From b50f7dd91a6645d5dd564a987b844a814dcb9b32 Mon Sep 17 00:00:00 2001 From: mhsanaei Date: Mon, 4 Aug 2025 16:48:13 +0200 Subject: [PATCH 3/4] inbound: pqv --- sub/subService.go | 10 ++++++++++ web/assets/js/model/inbound.js | 6 ++++++ 2 files changed, 16 insertions(+) diff --git a/sub/subService.go b/sub/subService.go index 9ea634aa..d9698729 100644 --- a/sub/subService.go +++ b/sub/subService.go @@ -429,6 +429,11 @@ func (s *SubService) genVlessLink(inbound *model.Inbound, email string) string { params["fp"] = fp } } + if pqvValue, ok := searchKey(realitySettings, "mldsa65Verify"); ok { + if pqv, ok := pqvValue.(string); ok && len(pqv) > 0 { + params["pqv"] = pqv + } + } params["spx"] = "/" + random.Seq(15) } @@ -619,6 +624,11 @@ func (s *SubService) genTrojanLink(inbound *model.Inbound, email string) string params["fp"] = fp } } + if pqvValue, ok := searchKey(realitySettings, "mldsa65Verify"); ok { + if pqv, ok := pqvValue.(string); ok && len(pqv) > 0 { + params["pqv"] = pqv + } + } params["spx"] = "/" + random.Seq(15) } } diff --git a/web/assets/js/model/inbound.js b/web/assets/js/model/inbound.js index 14570eb1..9e4d8e2d 100644 --- a/web/assets/js/model/inbound.js +++ b/web/assets/js/model/inbound.js @@ -1385,6 +1385,9 @@ class Inbound extends XrayCommonClass { if (!ObjectUtil.isEmpty(this.stream.reality.settings.spiderX)) { params.set("spx", this.stream.reality.settings.spiderX); } + if (!ObjectUtil.isEmpty(this.stream.reality.settings.mldsa65Verify)) { + params.set("pqv", this.stream.reality.settings.mldsa65Verify); + } if (type == 'tcp' && !ObjectUtil.isEmpty(flow)) { params.set("flow", flow); } @@ -1565,6 +1568,9 @@ class Inbound extends XrayCommonClass { if (!ObjectUtil.isEmpty(this.stream.reality.settings.spiderX)) { params.set("spx", this.stream.reality.settings.spiderX); } + if (!ObjectUtil.isEmpty(this.stream.reality.settings.mldsa65Verify)) { + params.set("pqv", this.stream.reality.settings.mldsa65Verify); + } } else { From 2d60543026049f3df67acf082a705e93899afc68 Mon Sep 17 00:00:00 2001 From: mhsanaei Date: Mon, 4 Aug 2025 16:54:28 +0200 Subject: [PATCH 4/4] use musl libc toolchains Co-Authored-By: elseif <253712+elseif@users.noreply.github.com> --- .github/workflows/docker.yml | 2 +- .github/workflows/release.yml | 127 ++++++++++++++++++++-------------- DockerInitFiles.sh | 2 +- 3 files changed, 77 insertions(+), 54 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index f2c332e3..aab209f8 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -7,7 +7,7 @@ on: jobs: build: - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index adc7de2b..59a768ec 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,13 +1,26 @@ name: Release X-UI on: - push: - tags: - - "*" workflow_dispatch: + release: + types: [published] + push: + branches: + - main + paths: + - '**.js' + - '**.css' + - '**.html' + - '**.sh' + - '**.go' + - 'go.mod' + - 'go.sum' + - 'x-ui.service' jobs: build: + permissions: + contents: write strategy: matrix: platform: @@ -15,10 +28,10 @@ jobs: - arm64 - armv7 - armv6 - - armv5 - 386 + - armv5 - s390x - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest steps: - name: Checkout repository uses: actions/checkout@v4 @@ -27,53 +40,56 @@ jobs: uses: actions/setup-go@v5 with: go-version-file: go.mod - - - name: Install dependencies - run: | - sudo apt-get update - if [ "${{ matrix.platform }}" == "arm64" ]; then - sudo apt install gcc-aarch64-linux-gnu - elif [ "${{ matrix.platform }}" == "armv7" ]; then - sudo apt install gcc-arm-linux-gnueabihf - elif [ "${{ matrix.platform }}" == "armv6" ]; then - sudo apt install gcc-arm-linux-gnueabihf - elif [ "${{ matrix.platform }}" == "armv5" ]; then - sudo apt install gcc-arm-linux-gnueabi - elif [ "${{ matrix.platform }}" == "386" ]; then - sudo apt install gcc-i686-linux-gnu - elif [ "${{ matrix.platform }}" == "s390x" ]; then - sudo apt install gcc-s390x-linux-gnu - fi + check-latest: true - name: Build x-ui run: | export CGO_ENABLED=1 export GOOS=linux export GOARCH=${{ matrix.platform }} - if [ "${{ matrix.platform }}" == "arm64" ]; then - export GOARCH=arm64 - export CC=aarch64-linux-gnu-gcc - elif [ "${{ matrix.platform }}" == "armv7" ]; then - export GOARCH=arm - export GOARM=7 - export CC=arm-linux-gnueabihf-gcc - elif [ "${{ matrix.platform }}" == "armv6" ]; then - export GOARCH=arm - export GOARM=6 - export CC=arm-linux-gnueabihf-gcc - elif [ "${{ matrix.platform }}" == "armv5" ]; then - export GOARCH=arm - export GOARM=5 - export CC=arm-linux-gnueabi-gcc - elif [ "${{ matrix.platform }}" == "386" ]; then - export GOARCH=386 - export CC=i686-linux-gnu-gcc - elif [ "${{ matrix.platform }}" == "s390x" ]; then - export GOARCH=s390x - export CC=s390x-linux-gnu-gcc - fi - - go build -ldflags "-w -s" -o xui-release -v main.go + TOOLCHAIN_URL="" + MUSL_CC_HOST="https://github.com/musl-cc/musl.cc/releases/download/v0.0.1" #http://musl.cc + case "${{ matrix.platform }}" in + amd64) + TOOLCHAIN_URL="$MUSL_CC_HOST/x86_64-linux-musl-cross.tgz" + ;; + arm64) + TOOLCHAIN_URL="$MUSL_CC_HOST/aarch64-linux-musl-cross.tgz" + ;; + armv7) + TOOLCHAIN_URL="$MUSL_CC_HOST/armv7l-linux-musleabihf-cross.tgz" + export GOARCH=arm + export GOARM=7 + ;; + armv6) + TOOLCHAIN_URL="$MUSL_CC_HOST/armv6-linux-musleabihf-cross.tgz" + export GOARCH=arm + export GOARM=6 + ;; + armv5) + TOOLCHAIN_URL="$MUSL_CC_HOST/arm-linux-musleabi-cross.tgz" + export GOARCH=arm + export GOARM=5 + ;; + 386) + TOOLCHAIN_URL="$MUSL_CC_HOST/i686-linux-musl-cross.tgz" + ;; + s390x) + TOOLCHAIN_URL="$MUSL_CC_HOST/s390x-linux-musl-cross.tgz" + ;; + esac + echo "Downloading musl toolchain for ${{ matrix.platform }}" + curl -LO "$TOOLCHAIN_URL" + tar -xf *.tgz + TOOLCHAIN_DIR=$(find . -maxdepth 1 -type d -name "*-cross" | head -n1) + TOOLCHAIN_DIR=$(realpath "$TOOLCHAIN_DIR") + export PATH="$TOOLCHAIN_DIR/bin:$PATH" + # Detect compiler + export CC=$(find $TOOLCHAIN_DIR/bin -name '*-gcc' | head -n1) + echo "Using CC=$CC" + go build -ldflags "-w -s -linkmode external -extldflags '-static'" -o xui-release -v main.go + file xui-release + ldd xui-release || echo "Static binary confirmed" mkdir x-ui cp xui-release x-ui/ @@ -84,7 +100,7 @@ jobs: cd x-ui/bin # Download dependencies - Xray_URL="https://github.com/XTLS/Xray-core/releases/download/v25.7.26/" + Xray_URL="https://github.com/XTLS/Xray-core/releases/download/v25.8.3/" if [ "${{ matrix.platform }}" == "amd64" ]; then wget -q ${Xray_URL}Xray-linux-64.zip unzip Xray-linux-64.zip @@ -101,14 +117,14 @@ jobs: wget -q ${Xray_URL}Xray-linux-arm32-v6.zip unzip Xray-linux-arm32-v6.zip rm -f Xray-linux-arm32-v6.zip - elif [ "${{ matrix.platform }}" == "armv5" ]; then - wget -q ${Xray_URL}Xray-linux-arm32-v5.zip - unzip Xray-linux-arm32-v5.zip - rm -f Xray-linux-arm32-v5.zip elif [ "${{ matrix.platform }}" == "386" ]; then wget -q ${Xray_URL}Xray-linux-32.zip unzip Xray-linux-32.zip rm -f Xray-linux-32.zip + elif [ "${{ matrix.platform }}" == "armv5" ]; then + wget -q ${Xray_URL}Xray-linux-arm32-v5.zip + unzip Xray-linux-arm32-v5.zip + rm -f Xray-linux-arm32-v5.zip elif [ "${{ matrix.platform }}" == "s390x" ]; then wget -q ${Xray_URL}Xray-linux-s390x.zip unzip Xray-linux-s390x.zip @@ -124,9 +140,16 @@ jobs: - name: Package run: tar -zcvf x-ui-linux-${{ matrix.platform }}.tar.gz x-ui - + + - name: Upload files to Artifacts + uses: actions/upload-artifact@v4 + with: + name: x-ui-linux-${{ matrix.platform }} + path: ./x-ui-linux-${{ matrix.platform }}.tar.gz + - name: Upload files to GH release uses: svenstaro/upload-release-action@v2 + if: github.event_name == 'release' && github.event.action == 'published' with: repo_token: ${{ secrets.GITHUB_TOKEN }} tag: ${{ github.ref }} diff --git a/DockerInitFiles.sh b/DockerInitFiles.sh index ca522254..bc7b0f6d 100755 --- a/DockerInitFiles.sh +++ b/DockerInitFiles.sh @@ -23,7 +23,7 @@ case $1 in esac mkdir -p build/bin cd build/bin -wget -q "https://github.com/XTLS/Xray-core/releases/download/v25.7.26/Xray-linux-${ARCH}.zip" +wget -q "https://github.com/XTLS/Xray-core/releases/download/v25.8.3/Xray-linux-${ARCH}.zip" unzip "Xray-linux-${ARCH}.zip" rm -f "Xray-linux-${ARCH}.zip" geoip.dat geosite.dat LICENSE README.md mv xray "xray-linux-${FNAME}"