diff --git a/.github/workflows/delete-old-workflows.yml b/.github/workflows/delete-old-workflows.yml new file mode 100644 index 00000000..598a36a6 --- /dev/null +++ b/.github/workflows/delete-old-workflows.yml @@ -0,0 +1,19 @@ +name: Delete old workflows +on: + workflow_dispatch: + schedule: + - cron: '0 22 * * *' + +jobs: + del_runs: + runs-on: ubuntu-latest + permissions: + actions: write + steps: + - name: Delete old workflow runs + uses: Mattraks/delete-workflow-runs@v2 + with: + token: ${{ github.token }} + repository: ${{ github.repository }} + retain_days: 3 + keep_minimum_runs: 1 diff --git a/.github/workflows/update-adguardhome.yml b/.github/workflows/update-adguardhome.yml new file mode 100644 index 00000000..923412c7 --- /dev/null +++ b/.github/workflows/update-adguardhome.yml @@ -0,0 +1,278 @@ +name: Update AdGuard Home +on: + workflow_dispatch: + schedule: + - cron: "0 17 * * *" + push: + branches: + - main + paths-ignore: + - "README.md" + - ".github/workflows/delete-old-workflows.yml" + - ".github/workflows/update-clashdashboard.yml" + - ".github/workflows/update-mihomo.yml" + - ".github/workflows/update-singbox.yml" + +jobs: + go: + runs-on: ubuntu-latest + outputs: + version: ${{ steps.go.outputs.version }} + steps: + - name: Get `Go` latest version + id: go + run: | + echo version=$(curl -sSL https://raw.githubusercontent.com/actions/go-versions/update-versions-manifest-file/versions-manifest.json | grep '"version"' | head -1 | awk -F'"' '{print $4}') >> $GITHUB_OUTPUT + + node: + runs-on: ubuntu-latest + outputs: + version: ${{ steps.node.outputs.version }} + steps: + - name: Get `Node` latest version (LTS) + id: node + run: | + echo version=$(curl -sSL https://nodejs.org/dist/index.json | jq -r 'map(select(.lts != false)) | .[0].version') >> $GITHUB_OUTPUT + + release: + runs-on: ubuntu-latest + needs: go + outputs: + release_version: ${{ steps.release.outputs.release_version }} + steps: + - name: Checkout `beta-v0.107` + uses: actions/checkout@v4 + with: + repository: AdguardTeam/AdGuardHome + ref: beta-v0.107 + fetch-depth: 0 + + - name: Setup `Go` + uses: actions/setup-go@v5 + with: + go-version: ${{ needs.go.outputs.version }} + + - name: Get `AdGuard Home Release` version + id: release + run: | + release_version=$(git describe --tags --abbrev=0 HEAD) + echo release_version=$release_version >> $GITHUB_OUTPUT + + release_cross: + runs-on: ubuntu-latest + strategy: + matrix: + include: + # Linux + - { name: linux_amd64, goos: linux, goarch: amd64, goamd64: v1 } + - { name: linux_armv5, goos: linux, goarch: arm, goarm: 5 } + - { name: linux_armv6, goos: linux, goarch: arm, goarm: 6 } + - { name: linux_armv7, goos: linux, goarch: arm, goarm: 7 } + - { name: linux_arm64, goos: linux, goarch: arm64 } + - { name: linux_mips_softfloat, goos: linux, goarch: mips, gomips: softfloat } + - { name: linux_mipsle_softfloat, goos: linux, goarch: mipsle, gomips: softfloat } + # Windows + - { name: windows_amd64, goos: windows, goarch: amd64, goamd64: v1 } + - { name: windows_arm64, goos: windows, goarch: arm64 } + + fail-fast: false + needs: + - go + - node + - release + env: + release_VERSION: ${{ needs.release.outputs.release_version }} + steps: + - name: Checkout `beta-v0.107` + uses: actions/checkout@v4 + with: + repository: AdguardTeam/AdGuardHome + ref: beta-v0.107 + fetch-depth: 1 + + - name: Setup `Go` + uses: actions/setup-go@v5 + with: + go-version: ${{ needs.go.outputs.version }} + + - name: Adapt `Go` version + run: | + go get go@${{ needs.go.outputs.version }} + go mod tidy + + - name: Setup `Node` + uses: actions/setup-node@v4 + with: + node-version: ${{ needs.node.outputs.version }} + + - name: Setup `Snapcraft` + run: | + sudo apt-get -yq --no-install-suggests --no-install-recommends install snapcraft + + - name: Build `AdGuard Home Release` + id: build + run: | + make SIGN=0 VERBOSE=1 ARCH=${{ matrix.goarch }} OS=${{ matrix.goos }} CHANNEL=release VERSION=${{ env.release_VERSION }} GOTOOLCHAIN=local build-release + + - name: Upload files to workspace + uses: actions/upload-artifact@v4 + with: + name: AdGuardHome_release_${{ matrix.name }} + path: '**/AdGuardHome/AdGuardHome*' + compression-level: 9 + + beta: + runs-on: ubuntu-latest + needs: go + outputs: + beta_version: ${{ steps.beta.outputs.beta_version }} + steps: + - name: Checkout `beta-v0.108` + uses: actions/checkout@v4 + with: + repository: AdguardTeam/AdGuardHome + ref: beta-v0.108 + fetch-depth: 0 + + - name: Setup `Go` + uses: actions/setup-go@v5 + with: + go-version: ${{ needs.go.outputs.version }} + + - name: Get `AdGuard Home Beta` version + id: beta + run: | + beta_version=$(git describe --tags --abbrev=0 HEAD) + echo beta_version=$beta_version >> $GITHUB_OUTPUT + + beta_cross: + runs-on: ubuntu-latest + strategy: + matrix: + include: + # Linux + - { name: linux_amd64, goos: linux, goarch: amd64, goamd64: v1 } + - { name: linux_armv5, goos: linux, goarch: arm, goarm: 5 } + - { name: linux_armv6, goos: linux, goarch: arm, goarm: 6 } + - { name: linux_armv7, goos: linux, goarch: arm, goarm: 7 } + - { name: linux_arm64, goos: linux, goarch: arm64 } + - { name: linux_mips_softfloat, goos: linux, goarch: mips, gomips: softfloat } + - { name: linux_mipsle_softfloat, goos: linux, goarch: mipsle, gomips: softfloat } + # Windows + - { name: windows_amd64, goos: windows, goarch: amd64, goamd64: v1 } + - { name: windows_arm64, goos: windows, goarch: arm64 } + + fail-fast: false + needs: + - go + - node + - beta + env: + beta_VERSION: ${{ needs.beta.outputs.beta_version }} + steps: + - name: Checkout `beta-v0.108` + uses: actions/checkout@v4 + with: + repository: AdguardTeam/AdGuardHome + ref: beta-v0.108 + fetch-depth: 1 + + - name: Setup `Go` + uses: actions/setup-go@v5 + with: + go-version: ${{ needs.go.outputs.version }} + + - name: Adapt `Go` version + run: | + go get go@${{ needs.go.outputs.version }} + go mod tidy + + - name: Setup `Node` + uses: actions/setup-node@v4 + with: + node-version: ${{ needs.node.outputs.version }} + + - name: Setup `Snapcraft` + run: | + sudo apt-get -yq --no-install-suggests --no-install-recommends install snapcraft + + - name: Build `AdGuard Home Beta` + id: build + run: | + make SIGN=0 VERBOSE=1 ARCH=${{ matrix.goarch }} OS=${{ matrix.goos }} CHANNEL=beta VERSION=${{ env.beta_VERSION }} GOTOOLCHAIN=local build-release + + - name: Upload files to workspace + uses: actions/upload-artifact@v4 + with: + name: AdGuardHome_beta_${{ matrix.name }} + path: '**/AdGuardHome/AdGuardHome*' + compression-level: 9 + + push_adguardhome: + needs: + - release_cross + - release + - beta_cross + - beta + runs-on: ubuntu-latest + env: + release_VERSION: ${{ needs.release.outputs.release_version }} + beta_VERSION: ${{ needs.beta.outputs.beta_version }} + steps: + - name: Clone Repository + uses: actions/checkout@main + + - name: Download files from workspace + uses: actions/download-artifact@v4 + with: + path: ./tmp-AdGuardHome/ + + - name: Batch move and rename `AdGuard Home` files + run: | + mkdir -p ./tmp-AdGuardHome/compress/ + archs=(amd64 armv5 armv6 armv7 arm64 mips_softfloat mipsle_softfloat) + new_name=(amd64 armv5 armv6 armv7 armv8 mips_softfloat mipsle_softfloat) + for ((i = 0; i < 7; i++)); do + mv -f "./tmp-AdGuardHome/AdGuardHome_release_linux_${archs[i]}/dist/AdGuardHome_linux_${archs[i]//v/_}/AdGuardHome/AdGuardHome" "./tmp-AdGuardHome/compress/AdGuardHome_release_linux_${new_name[i]}" + mv -f "./tmp-AdGuardHome/AdGuardHome_beta_linux_${archs[i]}/dist/AdGuardHome_linux_${archs[i]//v/_}/AdGuardHome/AdGuardHome" "./tmp-AdGuardHome/compress/AdGuardHome_beta_linux_${new_name[i]}" + done + chmod +x ./tmp-AdGuardHome/compress/* + + - name: Setup `upx` and compress `AdGuard Home` files + uses: crazy-max/ghaction-upx@v3 + with: + version: latest + files: ./tmp-AdGuardHome/compress/* + + - name: Move `AdGuard Home` files + run: | + mkdir -p ./AdGuardHome/ + mv -f ./tmp-AdGuardHome/compress/* ./AdGuardHome/ + # `Release` for Windows + mv -f ./tmp-AdGuardHome/AdGuardHome_release_windows_amd64/dist/AdGuardHome_windows_amd64/AdGuardHome/AdGuardHome.exe ./AdGuardHome/AdGuardHome_release_windows_amd64.exe + mv -f ./tmp-AdGuardHome/AdGuardHome_release_windows_arm64/dist/AdGuardHome_windows_arm64/AdGuardHome/AdGuardHome.exe ./AdGuardHome/AdGuardHome_release_windows_arm64.exe + + # `Beta` for Windows + mv -f ./tmp-AdGuardHome/AdGuardHome_beta_windows_amd64/dist/AdGuardHome_windows_amd64/AdGuardHome/AdGuardHome.exe ./AdGuardHome/AdGuardHome_beta_windows_amd64.exe + mv -f ./tmp-AdGuardHome/AdGuardHome_beta_windows_arm64/dist/AdGuardHome_windows_arm64/AdGuardHome/AdGuardHome.exe ./AdGuardHome/AdGuardHome_beta_windows_arm64.exe + rm -rf ./tmp* + + - name: Release and upload `AdGuardHome` assets + uses: svenstaro/upload-release-action@v2 + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + release_name: AdGuardHome + tag: AdGuardHome + overwrite: true + body: | + [AdGuardHome](https://github.com/AdguardTeam/AdGuardHome) Release 版和 Beta 版 + 更新 AdGuard Home Release 版至 ${{ env.release_VERSION }},更新 AdGuard Home Beta 版至 ${{ env.beta_VERSION }} + file_glob: true + file: ./AdGuardHome/* + + - name: Purge jsDelivr CDN + run: | + cd ./AdGuardHome/ || exit 1 + for file in $(ls); do + curl -i "https://purge.jsdelivr.net/gh/${{ github.repository }}@AdGuardHome/${file}" + done diff --git a/.github/workflows/update-clashdashboard.yml b/.github/workflows/update-clashdashboard.yml new file mode 100644 index 00000000..8f8f99b2 --- /dev/null +++ b/.github/workflows/update-clashdashboard.yml @@ -0,0 +1,84 @@ +name: Update Clash Dashboard +on: + workflow_dispatch: + schedule: + - cron: "30 17 * * *" + push: + branches: + - main + paths-ignore: + - "README.md" + - ".github/workflows/delete-old-workflows.yml" + - ".github/workflows/update-adguardhome.yml" + - ".github/workflows/update-mihomo.yml" + - ".github/workflows/update-singbox.yml" + +jobs: + Update: + runs-on: ubuntu-latest + steps: + - name: Clone Repository + uses: actions/checkout@main + + - name: Get version + run: | + razord_meta_download_version=$(curl -sSL https://api.github.com/repos/MetaCubeX/Razord-meta/tags | grep 'name' | head -n 1 | sed -e 's/.*v/v/' -e 's/".*//') + echo "razord_meta_download_version=${razord_meta_download_version}" >> ${GITHUB_ENV} + yacd_download_version=$(curl -sSL https://api.github.com/repos/haishanh/yacd/releases/latest | grep 'tag_name' | sed -e 's/.*v/v/' -e 's/".*//') + echo "yacd_download_version=${yacd_download_version}" >> ${GITHUB_ENV} + yacd_meta_download_version=$(curl -sSL https://api.github.com/repos/MetaCubeX/Yacd-meta/releases/latest | grep 'tag_name' | sed -e 's/.*v/v/' -e 's/".*//') + echo "yacd_meta_download_version=${yacd_meta_download_version}" >> ${GITHUB_ENV} + metacubexd_download_version=$(curl -sSL https://api.github.com/repos/MetaCubeX/metacubexd/releases/latest | grep 'tag_name' | sed -e 's/.*v/v/' -e 's/".*//') + echo "metacubexd_download_version=${metacubexd_download_version}" >> ${GITHUB_ENV} + + - name: Download and compress `Razord-meta` dashboard + run: | + mkdir -p ./Dashboard/ ./tmp/Razord-meta/ + curl -o ./tmp/Razord-meta/gh-pages.zip -L https://github.com/MetaCubeX/Razord-meta/archive/refs/heads/gh-pages.zip + unzip -o ./tmp/Razord-meta/gh-pages.zip -d ./tmp/Razord-meta/ + tar -czf ./Dashboard/Razord-meta.tar.gz -C ./tmp/Razord-meta/Razord-meta-gh-pages/ . + + - name: Download and compress `yacd` dashboard + run: | + mkdir -p ./tmp/yacd/ + curl -o ./tmp/yacd/gh-pages.zip -L https://github.com/haishanh/yacd/archive/refs/heads/gh-pages.zip + unzip -o ./tmp/yacd/gh-pages.zip -d ./tmp/yacd/ + tar -czf ./Dashboard/yacd.tar.gz -C ./tmp/yacd/yacd-gh-pages/ . + + - name: Download and compress `Yacd-meta` dashboard + run: | + mkdir -p ./tmp/Yacd-meta/ + curl -o ./tmp/Yacd-meta/gh-pages.zip -L https://github.com/MetaCubeX/Yacd-meta/archive/refs/heads/gh-pages.zip + unzip -o ./tmp/Yacd-meta/gh-pages.zip -d ./tmp/Yacd-meta/ + tar -czf ./Dashboard/Yacd-meta.tar.gz -C ./tmp/Yacd-meta/Yacd-meta-gh-pages/ . + + - name: Download and compress `metacubexd` dashboard + run: | + mkdir -p ./tmp/metacubexd/ + curl -o ./tmp/metacubexd/gh-pages.zip -L https://github.com/MetaCubeX/metacubexd/archive/refs/heads/gh-pages.zip + unzip -o ./tmp/metacubexd/gh-pages.zip -d ./tmp/metacubexd/ + tar -czf ./Dashboard/metacubexd.tar.gz -C ./tmp/metacubexd/metacubexd-gh-pages/ . + rm -rf ./tmp* + + - name: Release and upload `Dashboard` assets + uses: svenstaro/upload-release-action@v2 + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + release_name: Dashboard + tag: Dashboard + overwrite: true + body: | + Clash Dashboard,包括:[Razord-meta 面板](https://github.com/MetaCubeX/Razord-meta)、[yacd 面板](https://github.com/haishanh/yacd)、[Yacd-meta 面板](https://github.com/MetaCubeX/Yacd-meta)和 [metacubexd 面板](https://github.com/MetaCubeX/metacubexd) + 更新 Razord-meta 面板至 ${{ env.razord_meta_download_version }} + 更新 yacd 面板至 ${{ env.yacd_download_version }} + 更新 Yacd-meta 面板至 ${{ env.yacd_meta_download_version }} + 更新 metacubexd 面板至 ${{ env.metacubexd_download_version }} + file_glob: true + file: ./Dashboard/* + + - name: Purge jsDelivr CDN + run: | + cd ./Dashboard/ || exit 1 + for file in $(ls); do + curl -i "https://purge.jsdelivr.net/gh/${{ github.repository }}@Dashboard/${file}" + done diff --git a/.github/workflows/update-mihomo.yml b/.github/workflows/update-mihomo.yml new file mode 100644 index 00000000..2e47d538 --- /dev/null +++ b/.github/workflows/update-mihomo.yml @@ -0,0 +1,276 @@ +name: Update mihomo +on: + workflow_dispatch: + schedule: + - cron: "0 18 * * *" + push: + branches: + - main + paths-ignore: + - "README.md" + - ".github/workflows/delete-old-workflows.yml" + - ".github/workflows/update-adguardhome.yml" + - ".github/workflows/update-clashdashboard.yml" + - ".github/workflows/update-singbox.yml" + +jobs: + go: + runs-on: ubuntu-latest + outputs: + version: ${{ steps.go.outputs.version }} + steps: + - name: Get `Go` latest version + id: go + run: | + echo version=$(curl -sSL https://raw.githubusercontent.com/actions/go-versions/update-versions-manifest-file/versions-manifest.json | grep '"version"' | head -1 | awk -F'"' '{print $4}') >> $GITHUB_OUTPUT + + meta: + runs-on: ubuntu-latest + needs: go + outputs: + meta_version: ${{ steps.meta.outputs.meta_version }} + meta_tags: ${{ steps.meta.outputs.meta_tags }} + steps: + - name: Checkout `Meta` + uses: actions/checkout@v4 + with: + repository: MetaCubeX/mihomo + ref: Meta + fetch-depth: 0 + + - name: Setup `Go` + uses: actions/setup-go@v5 + with: + go-version: ${{ needs.go.outputs.version }} + + - name: Get `mihomo Meta` version + id: meta + run: | + meta_version=$(git describe --tags --abbrev=0 HEAD) + echo meta_version=$meta_version >> $GITHUB_OUTPUT + echo meta_tags=with_gvisor >> $GITHUB_OUTPUT + + meta_cross: + strategy: + matrix: + include: + # Linux + - { name: linux-amd64, goos: linux, goarch: amd64, goamd64: v1 } + - { name: linux-amd64-v3, goos: linux, goarch: amd64, goamd64: v3 } + - { name: linux-armv5, goos: linux, goarch: arm, goarm: 5 } + - { name: linux-armv6, goos: linux, goarch: arm, goarm: 6 } + - { name: linux-armv7, goos: linux, goarch: arm, goarm: 7 } + - { name: linux-arm64, goos: linux, goarch: arm64 } + - { name: linux-mips-softfloat, goos: linux, goarch: mips, gomips: softfloat } + - { name: linux-mipsle-softfloat, goos: linux, goarch: mipsle, gomips: softfloat } + - { name: linux-mipsle-hardfloat, goos: linux, goarch: mipsle, gomips: hardfloat } + # Windows + - { name: windows-amd64, goos: windows, goarch: amd64, goamd64: v1 } + - { name: windows-amd64-v3, goos: windows, goarch: amd64, goamd64: v3 } + - { name: windows-arm64, goos: windows, goarch: arm64 } + + fail-fast: false + runs-on: ubuntu-latest + needs: + - go + - meta + env: + GOOS: ${{ matrix.goos }} + GOARCH: ${{ matrix.goarch }} + GOAMD64: ${{ matrix.goamd64 }} + GOARM: ${{ matrix.goarm }} + GOMIPS: ${{ matrix.gomips }} + CGO_ENABLED: 0 + meta_TAGS: ${{ needs.meta.outputs.meta_tags }} + meta_VERSION: ${{ needs.meta.outputs.meta_version }} + steps: + - name: Checkout `Meta` + uses: actions/checkout@v4 + with: + repository: MetaCubeX/mihomo + ref: Meta + fetch-depth: 1 + + - name: Setup `Go` + uses: actions/setup-go@v5 + with: + go-version: ${{ needs.go.outputs.version }} + + - name: Set ENV + run: | + sudo timedatectl set-timezone "Asia/Shanghai" + echo "BUILDTIME=$(date)" >> $GITHUB_ENV + shell: bash + + - name: Build `mihomo Meta` core + id: build + run: go build -v -trimpath -ldflags "-X 'github.com/metacubex/mihomo/constant.Version=${meta_VERSION}' -X 'github.com/metacubex/mihomo/constant.BuildTime=${BUILDTIME}' -s -w -buildid=" -tags "${meta_TAGS}" -o meta + + - name: Upload files to workspace + uses: actions/upload-artifact@v4 + with: + name: mihomo-meta-${{ matrix.name }} + path: meta* + compression-level: 9 + + alpha: + runs-on: ubuntu-latest + needs: go + outputs: + alpha_version: ${{ steps.alpha.outputs.alpha_version }} + alpha_tags: ${{ steps.alpha.outputs.alpha_tags }} + steps: + - name: Checkout `Alpha` + uses: actions/checkout@v4 + with: + repository: MetaCubeX/mihomo + ref: Alpha + fetch-depth: 0 + + - name: Setup `Go` + uses: actions/setup-go@v5 + with: + go-version: ${{ needs.go.outputs.version }} + + - name: Get `mihomo Alpha` version + id: alpha + run: | + alpha_version=alpha-$(git rev-parse --short HEAD) + echo alpha_version=$alpha_version >> $GITHUB_OUTPUT + echo alpha_tags=with_gvisor >> $GITHUB_OUTPUT + + alpha_cross: + strategy: + matrix: + include: + # Linux + - { name: linux-amd64, goos: linux, goarch: amd64, goamd64: v1 } + - { name: linux-amd64-v3, goos: linux, goarch: amd64, goamd64: v3 } + - { name: linux-armv5, goos: linux, goarch: arm, goarm: 5 } + - { name: linux-armv6, goos: linux, goarch: arm, goarm: 6 } + - { name: linux-armv7, goos: linux, goarch: arm, goarm: 7 } + - { name: linux-arm64, goos: linux, goarch: arm64 } + - { name: linux-mips-softfloat, goos: linux, goarch: mips, gomips: softfloat } + - { name: linux-mipsle-softfloat, goos: linux, goarch: mipsle, gomips: softfloat } + - { name: linux-mipsle-hardfloat, goos: linux, goarch: mipsle, gomips: hardfloat } + # Windows + - { name: windows-amd64, goos: windows, goarch: amd64, goamd64: v1 } + - { name: windows-amd64-v3, goos: windows, goarch: amd64, goamd64: v3 } + - { name: windows-arm64, goos: windows, goarch: arm64 } + + fail-fast: false + runs-on: ubuntu-latest + needs: + - go + - alpha + env: + GOOS: ${{ matrix.goos }} + GOARCH: ${{ matrix.goarch }} + GOAMD64: ${{ matrix.goamd64 }} + GOARM: ${{ matrix.goarm }} + GOMIPS: ${{ matrix.gomips }} + CGO_ENABLED: 0 + alpha_TAGS: ${{ needs.alpha.outputs.alpha_tags }} + alpha_VERSION: ${{ needs.alpha.outputs.alpha_version }} + steps: + - name: Checkout `Alpha` + uses: actions/checkout@v4 + with: + repository: MetaCubeX/mihomo + ref: Alpha + fetch-depth: 1 + + - name: Setup `Go` + uses: actions/setup-go@v5 + with: + go-version: ${{ needs.go.outputs.version }} + + - name: Set ENV + run: | + sudo timedatectl set-timezone "Asia/Shanghai" + echo "BUILDTIME=$(date)" >> $GITHUB_ENV + shell: bash + + - name: Build `mihomo Alpha` core + id: build + run: go build -v -trimpath -ldflags "-X 'github.com/metacubex/mihomo/constant.Version=${alpha_VERSION}' -X 'github.com/metacubex/mihomo/constant.BuildTime=${BUILDTIME}' -s -w -buildid=" -tags "${alpha_TAGS}" -o meta + + - name: Upload files to workspace + uses: actions/upload-artifact@v4 + with: + name: mihomo-alpha-${{ matrix.name }} + path: meta* + compression-level: 9 + + push_mihomo: + needs: + - meta_cross + - meta + - alpha_cross + - alpha + runs-on: ubuntu-latest + env: + meta_VERSION: ${{ needs.meta.outputs.meta_version }} + alpha_VERSION: ${{ needs.alpha.outputs.alpha_version }} + steps: + - name: Clone Repository + uses: actions/checkout@main + + - name: Download files from workspace + uses: actions/download-artifact@v4 + with: + path: ./tmp-mihomo/ + + - name: Zip `mihomo` cores by `tar` + run: | + mkdir -p ./tmp-mihomo/compress/ + archs=(amd64 armv5 armv6 armv7 arm64 mips-softfloat mipsle-hardfloat mipsle-softfloat) + new_name=(amd64 armv5 armv6 armv7 armv8 mips-softfloat mipsle-hardfloat mipsle-softfloat) + # `Meta` cores + for ((i = 0; i < 8; i++)); do + mv -f "./tmp-mihomo/mihomo-meta-linux-${archs[i]}/meta" ./tmp-mihomo/CrashCore + chmod +x ./tmp-mihomo/CrashCore + tar --no-same-owner -czf "./tmp-mihomo/compress/mihomo-meta-linux-${new_name[i]}.tar.gz" -C ./tmp-mihomo/ ./CrashCore + done + + # `Alpha` cores + for ((i = 0; i < 8; i++)); do + mv -f "./tmp-mihomo/mihomo-alpha-linux-${archs[i]}/meta" ./tmp-mihomo/CrashCore + chmod +x ./tmp-mihomo/CrashCore + tar --no-same-owner -czf "./tmp-mihomo/compress/mihomo-alpha-linux-${new_name[i]}.tar.gz" -C ./tmp-mihomo/ ./CrashCore + done + + - name: Move `mihomo` cores + run: | + mkdir -p ./mihomo/ + mv -f ./tmp-mihomo/compress/* ./mihomo/ + # `Meta` cores for Windows + mv -f ./tmp-mihomo/mihomo-meta-windows-amd64/meta ./mihomo/mihomo-meta-windows-amd64.exe + mv -f ./tmp-mihomo/mihomo-meta-windows-amd64-v3/meta ./mihomo/mihomo-meta-windows-amd64v3.exe + mv -f ./tmp-mihomo/mihomo-meta-windows-arm64/meta ./mihomo/mihomo-meta-windows-arm64.exe + + # `Alpha` cores for Windows + mv -f ./tmp-mihomo/mihomo-alpha-windows-amd64/meta ./mihomo/mihomo-alpha-windows-amd64.exe + mv -f ./tmp-mihomo/mihomo-alpha-windows-amd64-v3/meta ./mihomo/mihomo-alpha-windows-amd64v3.exe + mv -f ./tmp-mihomo/mihomo-alpha-windows-arm64/meta ./mihomo/mihomo-alpha-windows-arm64.exe + rm -rf ./tmp* + + - name: Release and upload `mihomo` assets + uses: svenstaro/upload-release-action@v2 + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + release_name: mihomo + tag: mihomo + overwrite: true + body: | + [mihomo](https://github.com/MetaCubeX/mihomo) Meta 版和 Alpha 版内核 + 更新 Meta 版至 ${{ env.meta_VERSION }},更新 Alpha 版至 ${{ env.alpha_VERSION }} + file_glob: true + file: ./mihomo/* + + - name: Purge jsDelivr CDN + run: | + cd ./mihomo/ || exit 1 + for file in $(ls); do + curl -i "https://purge.jsdelivr.net/gh/${{ github.repository }}@mihomo/${file}" + done diff --git a/.github/workflows/update-singbox.yml b/.github/workflows/update-singbox.yml new file mode 100644 index 00000000..8601920d --- /dev/null +++ b/.github/workflows/update-singbox.yml @@ -0,0 +1,398 @@ +name: Update sing-box +on: + workflow_dispatch: + schedule: + - cron: "30 18 * * *" + push: + branches: + - main + paths-ignore: + - "README.md" + - ".github/workflows/delete-old-workflows.yml" + - ".github/workflows/update-adguardhome.yml" + - ".github/workflows/update-clashdashboard.yml" + - ".github/workflows/update-mihomo.yml" + +jobs: + go: + runs-on: ubuntu-latest + outputs: + version: ${{ steps.go.outputs.version }} + steps: + - name: Get `Go` latest version + id: go + run: | + echo version=$(curl -sSL https://raw.githubusercontent.com/actions/go-versions/update-versions-manifest-file/versions-manifest.json | grep '"version"' | head -1 | awk -F'"' '{print $4}') >> $GITHUB_OUTPUT + + puernya: + runs-on: ubuntu-latest + needs: go + outputs: + puernya_version: ${{ steps.puernya.outputs.puernya_version }} + puernya_tags: ${{ steps.puernya.outputs.puernya_tags }} + steps: + - name: Checkout `building` + uses: actions/checkout@v4 + with: + repository: PuerNya/sing-box + ref: building + fetch-depth: 0 + + - name: Setup `Go` + uses: actions/setup-go@v5 + with: + go-version: ${{ needs.go.outputs.version }} + + - name: Get `sing-box PuerNya` version + id: puernya + run: | + git remote add sekai https://github.com/SagerNet/sing-box.git + git fetch --tags sekai + puernya_version=$(CGO_ENABLED=0 go run ./cmd/internal/read_tag) + echo puernya_version=$puernya_version >> $GITHUB_OUTPUT + echo puernya_tags=with_quic,with_dhcp,with_wireguard,with_shadowsocksr,with_ech,with_utls,with_clash_api,with_gvisor >> $GITHUB_OUTPUT + + puernya_cross: + strategy: + matrix: + include: + # linux + - { name: linux-amd64, goos: linux, goarch: amd64, goamd64: v1 } + - { name: linux-amd64-v3, goos: linux, goarch: amd64, goamd64: v3 } + - { name: linux-armv5, goos: linux, goarch: arm, goarm: 5 } + - { name: linux-armv6, goos: linux, goarch: arm, goarm: 6 } + - { name: linux-armv7, goos: linux, goarch: arm, goarm: 7 } + - { name: linux-arm64, goos: linux, goarch: arm64 } + - { name: linux-mips-softfloat, goos: linux, goarch: mips, gomips: softfloat } + - { name: linux-mipsle-softfloat, goos: linux, goarch: mipsle, gomips: softfloat } + - { name: linux-mipsle-hardfloat, goos: linux, goarch: mipsle, gomips: hardfloat } + # windows + - { name: windows-amd64, goos: windows, goarch: amd64, goamd64: v1 } + - { name: windows-amd64-v3, goos: windows, goarch: amd64, goamd64: v3 } + - { name: windows-arm64, goos: windows, goarch: arm64 } + + fail-fast: false + runs-on: ubuntu-latest + needs: + - go + - puernya + env: + GOOS: ${{ matrix.goos }} + GOARCH: ${{ matrix.goarch }} + GOAMD64: ${{ matrix.goamd64 }} + GOARM: ${{ matrix.goarm }} + GOMIPS: ${{ matrix.gomips }} + CGO_ENABLED: 0 + puernya_TAGS: ${{ needs.puernya.outputs.puernya_tags }} + puernya_VERSION: ${{ needs.puernya.outputs.puernya_version }} + steps: + - name: Checkout `building` + uses: actions/checkout@v4 + with: + repository: PuerNya/sing-box + ref: building + fetch-depth: 1 + + - name: Fix sniff + run: sed -i 's/sniffHosts/sniffHost/' ./experimental/clashapi/trafficontrol/tracker.go + + - name: Setup `Go` + uses: actions/setup-go@v5 + with: + go-version: ${{ needs.go.outputs.version }} + + - name: Revert golang1.23 commit for Windows 7/8 + if: ${{ matrix.goos == 'windows' }} + run: | + cd $(go env GOROOT) + curl https://github.com/MetaCubeX/go/commit/9ac42137ef6730e8b7daca016ece831297a1d75b.diff | patch --verbose -p 1 + curl https://github.com/MetaCubeX/go/commit/21290de8a4c91408de7c2b5b68757b1e90af49dd.diff | patch --verbose -p 1 + curl https://github.com/MetaCubeX/go/commit/6a31d3fa8e47ddabc10bd97bff10d9a85f4cfb76.diff | patch --verbose -p 1 + curl https://github.com/MetaCubeX/go/commit/69e2eed6dd0f6d815ebf15797761c13f31213dd6.diff | patch --verbose -p 1 + + - name: Build `sing-box PuerNya` core + id: build + run: go build -v -trimpath -ldflags "-checklinkname=0 -X 'github.com/sagernet/sing-box/constant.Version=${puernya_VERSION}' -s -w -buildid=" -tags "${puernya_TAGS}" ./cmd/sing-box + + - name: Upload files to workspace + uses: actions/upload-artifact@v4 + with: + name: sing-box-puernya-${{ matrix.name }} + path: sing-box* + compression-level: 9 + + release: + runs-on: ubuntu-latest + needs: go + outputs: + release_version: ${{ steps.release.outputs.release_version }} + release_tags: ${{ steps.release.outputs.release_tags }} + steps: + - name: Checkout `main` + uses: actions/checkout@v4 + with: + repository: SagerNet/sing-box + ref: main + fetch-depth: 0 + + - name: Setup `Go` + uses: actions/setup-go@v5 + with: + go-version: ${{ needs.go.outputs.version }} + + - name: Get `sing-box Release` version + id: release + run: | + git remote add sekai https://github.com/SagerNet/sing-box.git + git fetch --tags sekai + release_version=$(CGO_ENABLED=0 go run ./cmd/internal/read_tag) + echo release_version=$release_version >> $GITHUB_OUTPUT + echo release_tags=with_gvisor,with_dhcp,with_wireguard,with_clash_api,with_quic,with_utls,with_ech >> $GITHUB_OUTPUT + + release_cross: + strategy: + matrix: + include: + # linux + - { name: linux-amd64, goos: linux, goarch: amd64, goamd64: v1 } + - { name: linux-amd64-v3, goos: linux, goarch: amd64, goamd64: v3 } + - { name: linux-armv5, goos: linux, goarch: arm, goarm: 5 } + - { name: linux-armv6, goos: linux, goarch: arm, goarm: 6 } + - { name: linux-armv7, goos: linux, goarch: arm, goarm: 7 } + - { name: linux-arm64, goos: linux, goarch: arm64 } + - { name: linux-mips-softfloat, goos: linux, goarch: mips, gomips: softfloat } + - { name: linux-mipsle-softfloat, goos: linux, goarch: mipsle, gomips: softfloat } + - { name: linux-mipsle-hardfloat, goos: linux, goarch: mipsle, gomips: hardfloat } + # windows + - { name: windows-amd64, goos: windows, goarch: amd64, goamd64: v1 } + - { name: windows-amd64-v3, goos: windows, goarch: amd64, goamd64: v3 } + - { name: windows-arm64, goos: windows, goarch: arm64 } + + fail-fast: false + runs-on: ubuntu-latest + needs: + - go + - release + env: + GOOS: ${{ matrix.goos }} + GOARCH: ${{ matrix.goarch }} + GOAMD64: ${{ matrix.goamd64 }} + GOARM: ${{ matrix.goarm }} + GOMIPS: ${{ matrix.gomips }} + CGO_ENABLED: 0 + release_TAGS: ${{ needs.release.outputs.release_tags }} + release_VERSION: ${{ needs.release.outputs.release_version }} + steps: + - name: Checkout `main` + uses: actions/checkout@v4 + with: + repository: SagerNet/sing-box + ref: main + fetch-depth: 1 + + - name: Setup `Go` + uses: actions/setup-go@v5 + with: + go-version: ${{ needs.go.outputs.version }} + + - name: Revert golang1.23 commit for Windows 7/8 + if: ${{ matrix.goos == 'windows' }} + run: | + cd $(go env GOROOT) + curl https://github.com/MetaCubeX/go/commit/9ac42137ef6730e8b7daca016ece831297a1d75b.diff | patch --verbose -p 1 + curl https://github.com/MetaCubeX/go/commit/21290de8a4c91408de7c2b5b68757b1e90af49dd.diff | patch --verbose -p 1 + curl https://github.com/MetaCubeX/go/commit/6a31d3fa8e47ddabc10bd97bff10d9a85f4cfb76.diff | patch --verbose -p 1 + curl https://github.com/MetaCubeX/go/commit/69e2eed6dd0f6d815ebf15797761c13f31213dd6.diff | patch --verbose -p 1 + + - name: Build `sing-box Release` core + id: build + run: go build -v -trimpath -ldflags "-checklinkname=0 -X 'github.com/sagernet/sing-box/constant.Version=${release_VERSION}' -s -w -buildid=" -tags "${release_TAGS}" ./cmd/sing-box + + - name: Upload files to workspace + uses: actions/upload-artifact@v4 + with: + name: sing-box-release-${{ matrix.name }} + path: sing-box* + compression-level: 9 + + dev: + runs-on: ubuntu-latest + needs: go + outputs: + dev_version: ${{ steps.dev.outputs.dev_version }} + dev_tags: ${{ steps.dev.outputs.dev_tags }} + steps: + - name: Checkout `dev` + uses: actions/checkout@v4 + with: + repository: SagerNet/sing-box + ref: dev + fetch-depth: 0 + + - name: Setup `Go` + uses: actions/setup-go@v5 + with: + go-version: ${{ needs.go.outputs.version }} + + - name: Get `sing-box Dev` version + id: dev + run: | + git remote add sekai https://github.com/SagerNet/sing-box.git + git fetch --tags sekai + dev_version=$(CGO_ENABLED=0 go run ./cmd/internal/read_tag) + echo dev_version=$dev_version >> $GITHUB_OUTPUT + echo dev_tags=with_gvisor,with_dhcp,with_wireguard,with_clash_api,with_quic,with_utls,with_ech >> $GITHUB_OUTPUT + + dev_cross: + strategy: + matrix: + include: + # linux + - { name: linux-amd64, goos: linux, goarch: amd64, goamd64: v1 } + - { name: linux-amd64-v3, goos: linux, goarch: amd64, goamd64: v3 } + - { name: linux-armv5, goos: linux, goarch: arm, goarm: 5 } + - { name: linux-armv6, goos: linux, goarch: arm, goarm: 6 } + - { name: linux-armv7, goos: linux, goarch: arm, goarm: 7 } + - { name: linux-arm64, goos: linux, goarch: arm64 } + - { name: linux-mips-softfloat, goos: linux, goarch: mips, gomips: softfloat } + - { name: linux-mipsle-softfloat, goos: linux, goarch: mipsle, gomips: softfloat } + - { name: linux-mipsle-hardfloat, goos: linux, goarch: mipsle, gomips: hardfloat } + # windows + - { name: windows-amd64, goos: windows, goarch: amd64, goamd64: v1 } + - { name: windows-amd64-v3, goos: windows, goarch: amd64, goamd64: v3 } + - { name: windows-arm64, goos: windows, goarch: arm64 } + + fail-fast: false + runs-on: ubuntu-latest + needs: + - go + - dev + env: + GOOS: ${{ matrix.goos }} + GOARCH: ${{ matrix.goarch }} + GOAMD64: ${{ matrix.goamd64 }} + GOARM: ${{ matrix.goarm }} + GOMIPS: ${{ matrix.gomips }} + CGO_ENABLED: 0 + dev_TAGS: ${{ needs.dev.outputs.dev_tags }} + dev_VERSION: ${{ needs.dev.outputs.dev_version }} + steps: + - name: Checkout `dev` + uses: actions/checkout@v4 + with: + repository: SagerNet/sing-box + ref: dev + fetch-depth: 1 + + - name: Setup `Go` + uses: actions/setup-go@v5 + with: + go-version: ${{ needs.go.outputs.version }} + + - name: Revert golang1.23 commit for Windows 7/8 + if: ${{ matrix.goos == 'windows' }} + run: | + cd $(go env GOROOT) + curl https://github.com/MetaCubeX/go/commit/9ac42137ef6730e8b7daca016ece831297a1d75b.diff | patch --verbose -p 1 + curl https://github.com/MetaCubeX/go/commit/21290de8a4c91408de7c2b5b68757b1e90af49dd.diff | patch --verbose -p 1 + curl https://github.com/MetaCubeX/go/commit/6a31d3fa8e47ddabc10bd97bff10d9a85f4cfb76.diff | patch --verbose -p 1 + curl https://github.com/MetaCubeX/go/commit/69e2eed6dd0f6d815ebf15797761c13f31213dd6.diff | patch --verbose -p 1 + + - name: Build `sing-box Dev` core + id: build + run: go build -v -trimpath -ldflags "-checklinkname=0 -X 'github.com/sagernet/sing-box/constant.Version=${dev_VERSION}' -s -w -buildid=" -tags "${dev_TAGS}" ./cmd/sing-box + + - name: Upload files to workspace + uses: actions/upload-artifact@v4 + with: + name: sing-box-dev-${{ matrix.name }} + path: sing-box* + compression-level: 9 + + push_sing-box: + needs: + - puernya_cross + - puernya + - release_cross + - release + - dev_cross + - dev + runs-on: ubuntu-latest + env: + puernya_VERSION: ${{ needs.puernya.outputs.puernya_version }} + release_VERSION: ${{ needs.release.outputs.release_version }} + dev_VERSION: ${{ needs.dev.outputs.dev_version }} + steps: + - name: Clone Repository + uses: actions/checkout@main + + - name: Download files from workspace + uses: actions/download-artifact@v4 + with: + path: ./tmp-sing-box/ + + - name: Zip `sing-box` cores by `tar` + run: | + mkdir -p ./tmp-sing-box/compress/ + archs=(amd64 amd64-v3 armv5 armv6 armv7 arm64 mips-softfloat mipsle-hardfloat mipsle-softfloat) + new_name=(amd64 amd64v3 armv5 armv6 armv7 armv8 mips-softfloat mipsle-hardfloat mipsle-softfloat) + # `PuerNya` cores + for ((i = 0; i < 9; i++)); do + mv -f "./tmp-sing-box/sing-box-puernya-linux-${archs[i]}/sing-box" ./tmp-sing-box/CrashCore + chmod +x ./tmp-sing-box/CrashCore + tar --no-same-owner -czf "./tmp-sing-box/compress/sing-box-puernya-linux-${new_name[i]}.tar.gz" -C ./tmp-sing-box/ ./CrashCore + done + + # `Release` cores + for ((i = 0; i < 9; i++)); do + mv -f "./tmp-sing-box/sing-box-release-linux-${archs[i]}/sing-box" ./tmp-sing-box/CrashCore + chmod +x ./tmp-sing-box/CrashCore + tar --no-same-owner -czf "./tmp-sing-box/compress/sing-box-release-linux-${new_name[i]}.tar.gz" -C ./tmp-sing-box/ ./CrashCore + done + + # `dev` cores + for ((i = 0; i < 9; i++)); do + mv -f "./tmp-sing-box/sing-box-dev-linux-${archs[i]}/sing-box" ./tmp-sing-box/CrashCore + chmod +x ./tmp-sing-box/CrashCore + tar --no-same-owner -czf "./tmp-sing-box/compress/sing-box-dev-linux-${new_name[i]}.tar.gz" -C ./tmp-sing-box/ ./CrashCore + done + + - name: Move `sing-box` cores + run: | + mkdir -p ./sing-box/ + mv -f ./tmp-sing-box/compress/* ./sing-box/ + # `PuerNya` cores for Windows + mv -f ./tmp-sing-box/sing-box-puernya-windows-amd64/sing-box.exe ./sing-box/sing-box-puernya-windows-amd64.exe + mv -f ./tmp-sing-box/sing-box-puernya-windows-amd64-v3/sing-box.exe ./sing-box/sing-box-puernya-windows-amd64v3.exe + mv -f ./tmp-sing-box/sing-box-puernya-windows-arm64/sing-box.exe ./sing-box/sing-box-puernya-windows-arm64.exe + + # `Release` cores for Windows + mv -f ./tmp-sing-box/sing-box-release-windows-amd64/sing-box.exe ./sing-box/sing-box-release-windows-amd64.exe + mv -f ./tmp-sing-box/sing-box-release-windows-amd64-v3/sing-box.exe ./sing-box/sing-box-release-windows-amd64v3.exe + mv -f ./tmp-sing-box/sing-box-release-windows-arm64/sing-box.exe ./sing-box/sing-box-release-windows-arm64.exe + + # `dev` cores for Windows + mv -f ./tmp-sing-box/sing-box-dev-windows-amd64/sing-box.exe ./sing-box/sing-box-dev-windows-amd64.exe + mv -f ./tmp-sing-box/sing-box-dev-windows-amd64-v3/sing-box.exe ./sing-box/sing-box-dev-windows-amd64v3.exe + mv -f ./tmp-sing-box/sing-box-dev-windows-arm64/sing-box.exe ./sing-box/sing-box-dev-windows-arm64.exe + rm -rf ./tmp* + + - name: Release and upload `sing-box` assets + uses: svenstaro/upload-release-action@v2 + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + release_name: sing-box + tag: sing-box + overwrite: true + body: | + [sing-box](https://github.com/SagerNet/sing-box) Release 版、Dev 版和 [PuerNya 版](https://github.com/PuerNya/sing-box/tree/building)内核 + 更新 PuerNya 版至 v${{ env.puernya_VERSION }},更新 Release 版至 v${{ env.release_VERSION }},更新 Dev 版至 v${{ env.dev_VERSION }} + file_glob: true + file: ./sing-box/* + + - name: Purge jsDelivr CDN + run: | + cd ./sing-box/ || exit 1 + for file in $(ls); do + curl -i "https://purge.jsdelivr.net/gh/${{ github.repository }}@sing-box/${file}" + done diff --git a/README.md b/README.md new file mode 100644 index 00000000..c6cf4bf2 --- /dev/null +++ b/README.md @@ -0,0 +1,122 @@ +**注意:本项目生成文件所在的分支已全部删除(包括文件历史记录),所有文件将不再发布到分支中,仅分发到 [Releases](https://github.com/DustinWin/clash_singbox-tools/releases) 中,以节省占用空间(文件历史记录过大),详细请看《[关于 GitHub 上的大文件](https://docs.github.com/zh/repositories/working-with-files/managing-large-files/about-large-files-on-github)》** + +# 更新 [mihomo 内核](https://github.com/MetaCubeX/mihomo)、[sing-box 内核](https://github.com/SagerNet/sing-box)、[sing-box PuerNya 版内核](https://github.com/PuerNya/sing-box/tree/building)、Clash dashboard 面板和 [AdGuard Home](https://github.com/AdguardTeam/AdGuardHome) +# 一、 说明 +每天凌晨(北京时间 UTC+8)自动构建生成: +1. Clash Premium Release 版和 Nightly 版[内核](https://github.com/DustinWin/clash_singbox-tools/releases/tag/Clash-Premium)(已停更) +2. mihomo Meta 版和 Alpha 版内核 +3. sing-box Release 版和 Dev 版内核 +4. sing-box PuerNya 版内核(支持 `outbound_providers` 代理集合) +5. Clash dashboard 面板:[Razord-meta 面板](https://github.com/MetaCubeX/Razord-meta)、[yacd 面板](https://github.com/haishanh/yacd)、[Yacd-meta 面板](https://github.com/MetaCubeX/Yacd-meta)和 [metacubexd 面板](https://github.com/MetaCubeX/metacubexd) +6. AdGuard Home Release 版和 Beta 版 + +**注:** +- 1. 本教程中的下载链接以 CPU 架构 ARMv8 为例,请注意修改链接后缀 +- 2. 查看 CPU 架构可连接 SSH 后执行命令 `uname -ms`,若执行结果是“linux aarch64”,就是搭载的 ARMv8 架构 + +# 二、 使用方法 +## 1. 导入内核(以 [ShellCrash](https://github.com/juewuy/ShellCrash) 导入内核为例) +**mihomo 内核和 sing-box 内核 Linux 版下载链接后缀和 CPU 架构对应关系如下表:** +|CPU 架构|AMD64|AMD64v3|ARMv5|ARMv6|ARMv7|ARMv8&ARM64&AArch64|mips-softfloat|mipsle-hardfloat|mipsle-softfloat| +|-----|-----|-----|-----|-----|-----|:---:|-----|-----|-----| +|**链接后缀**|`amd64`|`amd64v3`|`armv5`|`armv6`|`armv7`|`armv8`|`mips-softfloat`|`mipsle-hardfloat`|`mipsle-softfloat`| + +
+① 首次导入 + +连接 SSH 后执行如下命令: +``` +# mihomo 内核 Meta 版 +curl -L https://cdn.jsdelivr.net/gh/DustinWin/clash_singbox-tools@mihomo/mihomo-meta-linux-armv8.tar.gz | tar -zx -C /tmp/ && crash +# mihomo 内核 Alpha 版 +curl -L https://cdn.jsdelivr.net/gh/DustinWin/clash_singbox-tools@mihomo/mihomo-alpha-linux-armv8.tar.gz | tar -zx -C /tmp/ && crash +# sing-box 内核 PuerNya 版 +curl -L https://cdn.jsdelivr.net/gh/DustinWin/clash_singbox-tools@sing-box/sing-box-puernya-linux-armv8.tar.gz | tar -zx -C /tmp/ && crash +# sing-box 内核 Release 版 +curl -L https://cdn.jsdelivr.net/gh/DustinWin/clash_singbox-tools@sing-box/sing-box-release-linux-armv8.tar.gz | tar -zx -C /tmp/ && crash +# sing-box 内核 Dev 版 +curl -L https://cdn.jsdelivr.net/gh/DustinWin/clash_singbox-tools@sing-box/sing-box-dev-linux-armv8.tar.gz | tar -zx -C /tmp/ && crash +``` +此时脚本会自动“发现可用的内核文件”,选择 1 加载,后选择对应的内核 +
+
+② 升级导入(ShellCrash -> 9 更新/卸载 -> 2 切换内核文件,内核版本不会刷新) + +连接 SSH 后执行如下命令: +``` +# mihomo 内核 Meta 版 +curl -o $CRASHDIR/CrashCore.tar.gz -L https://cdn.jsdelivr.net/gh/DustinWin/clash_singbox-tools@mihomo/mihomo-meta-linux-armv8.tar.gz && $CRASHDIR/start.sh restart +# mihomo 内核 Alpha 版 +curl -o $CRASHDIR/CrashCore.tar.gz -L https://cdn.jsdelivr.net/gh/DustinWin/clash_singbox-tools@mihomo/mihomo-alpha-linux-armv8.tar.gz && $CRASHDIR/start.sh restart +# sing-box 内核 PuerNya 版 +curl -o $CRASHDIR/CrashCore.tar.gz -L https://cdn.jsdelivr.net/gh/DustinWin/clash_singbox-tools@sing-box/sing-box-puernya-linux-armv8.tar.gz && $CRASHDIR/start.sh restart +# sing-box 内核 Release 版 +curl -o $CRASHDIR/CrashCore.tar.gz -L https://cdn.jsdelivr.net/gh/DustinWin/clash_singbox-tools/@sing-box/sing-box-release-linux-armv8.tar.gz && $CRASHDIR/start.sh restart +# sing-box 内核 Dev 版 +curl -o $CRASHDIR/CrashCore.tar.gz -L https://cdn.jsdelivr.net/gh/DustinWin/clash_singbox-tools@sing-box/sing-box-dev-linux-armv8.tar.gz && $CRASHDIR/start.sh restart +``` +
+ +## 2. 安装 Clash Dashboard 面板(以 ShellCrash 安装 metacubexd 面板为例) +**Clash Dashboard 面板对应文件名和在线地址关系如下表:** +|面板类型|文件名|在线地址| +|-----|-----|-----| +|Razord-meta 面板|`Razord-meta.tar.gz`|https://clash.metacubex.one| +|yacd 面板|`yacd.tar.gz`|https://yacd.haishan.me| +|Yacd-meta 面板|`Yacd-meta.tar.gz`|https://yacd.metacubex.one| +|metacubexd 面板|`metacubexd.tar.gz`|https://metacubex.github.io/metacubexd| + +连接 SSH 后执行如下命令: +``` +curl -L https://cdn.jsdelivr.net/gh/DustinWin/clash_singbox-tools@Dashboard/metacubexd.tar.gz | tar -zx -C $CRASHDIR/ui/ && $CRASHDIR/start.sh restart +``` +## 3. 安装 AdGuard Home +**AdGuard Home Linux 版 CPU 架构和链接后缀对应关系如下表:** +|CPU 架构|AMD64|ARMv5|ARMv6|ARMv7|ARMv8|mips-softfloat|mipsle-softfloat| +|-----|-----|-----|-----|-----|-----|-----|-----| +|**链接后缀**|`amd64`|`armv5`|`armv6`|`armv7`|`armv8`|`mips-softfloat`|`mipsle-softfloat`| + +
+① 安装 AdGuard Home + +连接 SSH 后执行如下命令: +``` +mkdir -p /data/AdGuardHome +# AdGuard Home Release 版 +curl -o /data/AdGuardHome/AdGuardHome -L https://cdn.jsdelivr.net/gh/DustinWin/clash_singbox-tools@AdGuardHome/AdGuardHome_release_linux_armv8 +# AdGuard Home Beta 版 +curl -o /data/AdGuardHome/AdGuardHome -L https://cdn.jsdelivr.net/gh/DustinWin/clash_singbox-tools@AdGuardHome/AdGuardHome_beta_linux_armv8 +chmod +x /data/AdGuardHome/AdGuardHome +/data/AdGuardHome/AdGuardHome -s install +/data/AdGuardHome/AdGuardHome -s start +``` +
+
+② 升级 AdGuard Home + +连接 SSH 后执行如下命令: +``` +# AdGuard Home Release 版 +curl -o /data/AdGuardHome/AdGuardHome -L https://ghp.ci/https://github.com/DustinWin/clash_singbox-tools/releases/download/AdGuardHome/AdGuardHome_release_linux_armv8 +# AdGuard Home Beta 版 +curl -o /data/AdGuardHome/AdGuardHome -L https://ghp.ci/https://github.com/DustinWin/clash_singbox-tools/releases/download/AdGuardHome/AdGuardHome_beta_linux_armv8 +/data/AdGuardHome/AdGuardHome -s restart +``` +
+ +# 三、 扩展(以 ShellCrash 配置定时任务为例) +可在 ShellCrash 里添加定时更新 mihomo 内核、sing-box 内核、metacubexd 面板和 AdGuard Home 的任务 +1. 连接 SSH 后执行 `vi $CRASHDIR/task/task.user`,按一下 Ins 键(Insert 键),粘贴如下内容: +注: +- 1. 留意链接后缀是否与 CPU 架构匹配 +- 2. ShellCrash 安装路径为 */data/ShellCrash* + +``` +201#curl -o /data/ShellCrash/CrashCore.tar.gz -L https://cdn.jsdelivr.net/gh/DustinWin/clash_singbox-tools@mihomo/mihomo-meta-linux-armv8.tar.gz && /data/ShellCrash/start.sh restart >/dev/null 2>&1#更新mihomo内核 +202#curl -o /data/ShellCrash/CrashCore.tar.gz -L https://cdn.jsdelivr.net/gh/DustinWin/clash_singbox-tools@sing-box/sing-box-puernya-linux-armv8.tar.gz && /data/ShellCrash/start.sh restart >/dev/null 2>&1#更新sing-box_PuerNya版内核 +203#curl -o /data/ShellCrash/CrashCore.tar.gz -L https://cdn.jsdelivr.net/gh/DustinWin/clash_singbox-tools@sing-box/sing-box-release-linux-armv8.tar.gz && /data/ShellCrash/start.sh restart >/dev/null 2>&1#更新sing-box内核 +204#curl -L https://cdn.jsdelivr.net/gh/DustinWin/clash_singbox-tools@Dashboard/metacubexd.tar.gz | tar -zx -C $CRASHDIR/ui/ && /data/ShellCrash/start.sh restart >/dev/null 2>&1#更新metacubexd面板 +205#curl -o /data/AdGuardHome/AdGuardHome -L https://cdn.jsdelivr.net/gh/DustinWin/clash_singbox-tools@AdGuardHome/AdGuardHome_beta_linux_armv8 && /data/AdGuardHome/AdGuardHome -s restart >/dev/null 2>&1#更新AdGuardHome +``` +2. 按一下 Esc 键(退出键),输入英文冒号 `:`,继续输入 `wq` 并回车 +3. 执行 `crash`,进入 ShellCrash -> 5 配置自动任务 -> 1 添加自动任务,可以看到末尾就有添加的定时任务,输入对应的数字并回车后可设置执行条件