优化批量检测超时机制和用户体验 #18
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build and Release | |
| on: | |
| push: | |
| tags: | |
| - 'v*' | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| packages: write | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Go | |
| uses: actions/setup-go@v4 | |
| with: | |
| go-version: '1.21' | |
| - name: Get version from tag | |
| id: version | |
| run: | | |
| if [[ "${{ github.ref }}" == refs/tags/* ]]; then | |
| VERSION=${GITHUB_REF#refs/tags/} | |
| else | |
| VERSION="dev-$(date +%Y%m%d-%H%M%S)" | |
| fi | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| echo "Building version: $VERSION" | |
| - name: Get build time | |
| id: build_time | |
| run: | | |
| BUILD_TIME=$(date -u +"%Y-%m-%d %H:%M:%S UTC") | |
| echo "time=$BUILD_TIME" >> $GITHUB_OUTPUT | |
| - name: Build for multiple platforms | |
| run: | | |
| # 创建输出目录 | |
| mkdir -p dist | |
| # 设置版本信息 | |
| VERSION="${{ steps.version.outputs.version }}" | |
| COMMIT=$(git rev-parse --short HEAD) | |
| BUILD_TIME=$(date -u +"%Y-%m-%dT%H:%M:%SZ") | |
| # 构建标志 - 添加静态编译选项解决GLIBC兼容性问题 | |
| LDFLAGS="-X RealityChecker/internal/version.Version=$VERSION -X RealityChecker/internal/version.Commit=$COMMIT -X RealityChecker/internal/version.BuildTime=$BUILD_TIME -s -w" | |
| # Linux AMD64 - 静态编译 | |
| CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags "$LDFLAGS" -tags netgo -installsuffix netgo -o reality-checker . | |
| chmod +x reality-checker | |
| zip -j dist/reality-checker-linux-amd64.zip reality-checker | |
| rm reality-checker | |
| # Linux ARM64 - 静态编译 | |
| CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -ldflags "$LDFLAGS" -tags netgo -installsuffix netgo -o reality-checker . | |
| chmod +x reality-checker | |
| zip -j dist/reality-checker-linux-arm64.zip reality-checker | |
| rm reality-checker | |
| # 显示构建结果 | |
| ls -la dist/ | |
| - name: Create Release | |
| if: startsWith(github.ref, 'refs/tags/') | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| files: | | |
| dist/* | |
| body: | | |
| ## Reality协议目标网站检测工具 ${{ steps.version.outputs.version }} | |
| ### 使用方法 | |
| 详细使用方法请参考 [README.md](https://github.com/V2RaySSR/RealityChecker/blob/main/README.md) | |
| **下载说明:** | |
| - `reality-checker-linux-amd64.zip` - Linux x86_64 | |
| - `reality-checker-linux-arm64.zip` - Linux ARM64 | |
| **基本命令:** | |
| ```bash | |
| # 单域名检测 | |
| ./reality-checker check example.com | |
| # 批量检测 | |
| ./reality-checker batch domain1 domain2 domain3 | |
| # CSV文件检测 | |
| ./reality-checker csv domains.csv | |
| ``` | |
| **推荐工作流程:** | |
| 1. 使用 [RealiTLScanner](https://github.com/XTLS/RealiTLScanner) 扫描VPS IP: | |
| ```bash | |
| ./RealiTLScanner -addr <VPS IP> -port 443 -thread 100 -timeout 5 -out file.csv | |
| ``` | |
| 2. 使用本工具检测生成的CSV文件: | |
| ```bash | |
| ./reality-checker csv file.csv | |
| ``` | |
| **重要提示:** | |
| - RealiTLScanner 尽量在本地运行,不要在远端 | |
| - 多次运行RealiTLScanner时,请更改输出文件名,如:`file1.csv`、`file2.csv`、`file3.csv` 等 | |
| - 如果使用相同的文件名,可能会导致文件导出失败或覆盖之前的扫描结果 | |
| ### 版本信息 | |
| - **版本**: ${{ steps.version.outputs.version }} | |
| - **提交**: ${{ github.sha }} | |
| - **构建时间**: ${{ steps.build_time.outputs.time }} | |
| --- | |
| **注意**: 本工具仅用于技术研究和学习目的,请遵守当地法律法规。 | |
| draft: false | |
| prerelease: false | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Upload artifacts (for non-tag builds) | |
| if: ${{ !startsWith(github.ref, 'refs/tags/') }} | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: reality-checker-builds | |
| path: dist/ |