{"id":30695716,"url":"https://github.com/kdwkakcs/singtools","last_synced_at":"2025-09-02T07:05:18.278Z","repository":{"id":299435373,"uuid":"885789109","full_name":"Kdwkakcs/singtools","owner":"Kdwkakcs","description":"tools for test proxy (speed, ping, country) using sing-box core","archived":false,"fork":false,"pushed_at":"2025-06-16T15:26:18.000Z","size":24,"stargazers_count":23,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-01T00:29:42.656Z","etag":null,"topics":["clash","hiddify","hysteria","hysteria2","sing-box","vless"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Kdwkakcs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-11-09T12:01:34.000Z","updated_at":"2025-07-06T04:39:48.000Z","dependencies_parsed_at":"2025-06-16T15:37:28.063Z","dependency_job_id":null,"html_url":"https://github.com/Kdwkakcs/singtools","commit_stats":null,"previous_names":["kdwkakcs/singtools"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/Kdwkakcs/singtools","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kdwkakcs%2Fsingtools","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kdwkakcs%2Fsingtools/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kdwkakcs%2Fsingtools/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kdwkakcs%2Fsingtools/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Kdwkakcs","download_url":"https://codeload.github.com/Kdwkakcs/singtools/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kdwkakcs%2Fsingtools/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273244348,"owners_count":25070960,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-02T02:00:09.530Z","response_time":77,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["clash","hiddify","hysteria","hysteria2","sing-box","vless"],"created_at":"2025-09-02T07:05:17.315Z","updated_at":"2025-09-02T07:05:18.270Z","avatar_url":"https://github.com/Kdwkakcs.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# SingTools 使用说明\n\nSingTools 是一个基于 sing-box 的节点测试工具，可以测试节点的延迟和速度。支持多种协议，包括 Shadowsocks、Trojan、VMess、Hysteria、Hysteria2、Vless 等。\n\n## 功能特点\n\n   - 支持多种协议测试\n   - 并发测试提高效率\n   - 支持延迟和速度测试\n   - 支持地理位置检测\n   - 支持节点去重和排序\n   - 提供详细的测试统计\n\n## 安装说明\n### 从 Release 下载\n\n访问 [GitHub Releases](https://github.com/Kdwkakcs/singtools/releases) 页面下载对应平台的预编译版本：\n\n## 1. 命令概述\n\n```bash\nUsage:\n  singtools test [flags]\n\nFlags:\n  -c, --config string   Path to test configuration file that defines test parameters:\n                        - Test URLs for connectivity checks\n                        - Timeout settings for various operations\n                        - Speed test parameters and thresholds\n                        - Other test-specific configurations\n  -d, --detect          Enable country detection for proxies.\n                        When enabled:\n                        - Determines the geographical location of each node\n                        - Adds country information to the test results\n                        - Helps in organizing nodes by region\n                        Note: Enabling this option may increase overall processing time\n  -f, --filter string   Filter nodes based on protocol type.\n                        Specify comma-separated list of protocols to include.\n                        Supported protocols:\n                        - shadowsocks\n                        - vmess\n                        - trojan\n                        - tls\n                        Default: 'tls, shadowsocks' (default \"tls, shadowsocks\")\n  -h, --help            help for test\n  -i, --input string    Path to input configuration file. Supports:\n                        - Local file path (e.g., ./config.json)\n                        - HTTP/HTTPS URL for remote config\n                        - Sing-box format configuration\n                        This parameter is required.\n  -e, --level string    Set logging level for operation feedback.\n                        Available options:\n                        - debug: Show detailed debugging information\n                        - info:  Show informational messages\n                        - warn:  Show warning messages (default)\n                        - error: Show only error messages\n                        - fatal: Show only fatal errors\n                        Higher levels include all lower level messages (default \"warn\")\n  -m, --meta string     Path to save detailed test results metadata including:\n                        - Comprehensive latency measurements\n                        - Detailed speed test results\n                        - Connection success/failure statistics\n                        - Country information (if detection is enabled)\n                        - Protocol-specific performance data\n                        Default: meta.json in current directory (default \"meta.json\")\n  -o, --output string   Path to save the filtered and tested configuration file.\n                        The output file will contain only working nodes that passed the tests.\n                        Default: out.json in current directory (default \"out.json\")\n  -r, --remote          Enable remote IP detection for each proxy.\n                        When enabled:\n                        - Tests and records the exit IP for each node\n                        - Verifies actual proxy endpoint\n                        - Helps identify unique proxies\n                        Note: This will increase testing time per node\n\nGlobal Flags:\n  -v, --version   Show version information\n```\n\n主要用于测试 sing-box 支持的所有协议的延迟和速度，支持本地配置文件和在线订阅链接，同时支持多种配置文件格式（包括 mixed, clash, sing-box等），目前仅支持输出为sing-box格式，可以使用subconverter(https://github.com/asdlokj1qpi233/subconverter)转换为其他格式。\n\n### 简短说明如何使用subconverter进行不同订阅格式之间的转换，后期可能会增加输出为其他格式的功能\n```bash\n# 安装subconverter\n# 从 https://github.com/asdlokj1qpi233/subconverter/releases release页面下载对应平台的预编译版本，解压后运行即可。\n# 其他的版本的subconverter暂时不支持singbox格式转换为其其他格式，\n./subconverter \n\n# 将singtools的输出结果转换为clash格式，/path/to/singtools/out.json为你本地singtools的输出结果路径，windows中自行尝试路径以及如何调用subconverter，可能需要将\\\\替换为/\ncurl http://127.0.0.1:25500/sub?target=clash\u0026url=/path/to/singtools/out.json\n# 或者在本地游览器中打开 http://127.0.0.1:25500/sub?target=clash\u0026url=/path/to/singtools/out.json\n```\n\n## 2. 命令参数\n\n| 参数 | 简写 | 默认值 | 说明 |\n|------|------|--------|------|\n| --input | -i | 无(必填) | 输入文件路径，支持本地文件或 HTTP(S) URL |\n| --output | -o | out.json | 输出文件路径 |\n| --config | -c | 无 | 配置文件路径 |\n| --detect | -d | false | 是否检测节点所在国家 |\n| --meta | -m | meta.json | 元数据输出文件路径 |\n| --download | -l | false | 是否下载 MMDB 数据库 |\n| --level | -e | warn | 日志级别(trace/debug/info/warn/error/fatal/panic) |\n| --remote | -r | false | 是否获取远程 IP |\n| --filter | -f | \"tls, shadowsocks\" | 基于类型过滤节点，用逗号分隔 |\n\n## 3. 配置文件说明\n\n配置文件使用 JSON 格式，支持以下主要配置项：\n\n### 3.1 基本配置\n\n```json\n{\n  \"group\": \"Default\",                 // 分组名称，默认为 \"Default\"\n  \"speedtestMode\": \"all\",            // 测试模式: \"all\", \"pingonly\", \"speedonly\"\n  \"pingUrl\": \"https://www.gstatic.com/generate_204\",  // 延迟测试URL\n  \"downloadUrl\": \"https://download.microsoft.com/download/2/7/A/27AF1BE6-DD20-4CB4-B154-EBAB8A7D4A7E/officedeploymenttool_18129-20030.exe\",  // 速度测试下载文件\n  \"filter\": \"all\",                   // 节点过滤规则，默认为 \"all\" TODO: 后期增加更多过滤规则\n  \"pingMethod\": \"http\",              // 延迟测试方法: \"http\", \"tcp\"\n  \"sortMethod\": \"speed\"              // 排序方法: \"speed\", \"ping\"\n}\n```\n\n### 3.2 性能配置\n\n```json\n{\n  \"concurrency\": 5,                  // 并发数，默认为 16\n  \"timeout\": 10,                     // 超时时间(秒)，默认为 10，最大为 16\n  \"bufferSize\": 32768,              // 缓冲区大小(字节)，默认为 32KB\n  \"retryAttempts\": 2,               // 重试次数，默认为 2\n  \"retryDelay\": 1                   // 重试延迟(秒)，默认为 1\n}\n```\n\n### 3.3 功能开关\n\n```json\n{\n  \"detect\": false,                   // 是否启用国家检测\n  \"removeDup\": false,               // 是否去除重复节点\n  \"enableMetrics\": true,            // 是否启用指标统计\n  \"remoteIP\": false,                // 是否检测远程IP\n  \"logLevel\": \"INFO\",               // 日志级别: \"INFO\", \"DEBUG\", \"WARN\", \"ERROR\"\n  \"logFile\": \"speedtest.log\",       // 日志文件路径\n  \"geoipDbPath\": \"GeoLite2-Country.mmdb\",  // GeoIP数据库路径\n  \"downloadTimeout\": 30,            // 下载超时时间(秒)，默认为 30\n  \"downloadRetries\": 2,             // 下载重试次数，默认为 2\n  \"downloadBufferSize\": 32768       // 下载缓冲区大小(字节)，默认为 32KB\n}\n```\n\n## 4. 主要功能\n\n1. **延迟测试**：\n   - 支持 HTTP 和 TCP 两种测试方式\n   - 默认使用 Google 生成的 204 页面测试\n   - 可配置重试次数和超时时间\n\n2. **速度测试**：\n   - 支持并发测试\n   - 可配置下载文件大小和缓冲区大小\n   - 提供平均速度和最大速度数据\n\n3. **地理位置检测**：\n   - 支持自动下载 GeoLite2 数据库\n   - 可检测节点所在国家/地区\n   - 支持 IP 地址缓存\n\n4. **结果处理**：\n   - 支持节点去重\n   - 支持多种排序方式（速度/延迟）\n   - 提供详细的测试统计信息\n\n## 5. 使用示例\n\n### 5.1 基本使用\n\n```bash\n# 测试本地配置文件\nsingtools test -i sing-box.json\n\n# 测试在线订阅链接\nsingtools test -i https://example.com/sub\n\n# 指定输出文件\nsingtools test -i sing-box.json -o result.json\n```\n\n### 5.2 高级使用\n\n```bash\n# 使用自定义配置文件测试\nsingtools test -i sing-box.json -c custom_config.json\n\n# 启用国家检测并下载 MMDB\nsingtools test -i sing-box.json -d -l\n\n# 使用详细日志级别\nsingtools test -i sing-box.json -e debug\n\n# 过滤特定类型节点（使用逗号分隔），默认过滤tls和shadowsocks，如果不想过滤，则使用 -f \"\"\nsingtools test -i sing-box.json -f \"vmess,trojan\"\n```\n\n## 6. 注意事项\n\n1. 输入文件必须是有效的 sing-box 配置格式，如果不是会自动尝试转换\n2. 超时设置：\n   - 单个节点测试超时默认为 10 秒\n   - 下载测试超时默认为 30 秒\n3. 并发设置：\n   - 默认并发数为 5\n   - 可通过配置文件调整\n\n## 7. 输出说明\n\n工具会生成两个主要输出文件：\n\n1. **测试结果文件** (默认: out.json)：\n   - 包含所有可用节点的完整配置\n   - 按照指定方式排序\n\n2. **元数据文件** (默认: meta.json)：\n   - 包含节点的测试数据\n   - 包括延迟、速度、地理位置等信息\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkdwkakcs%2Fsingtools","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkdwkakcs%2Fsingtools","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkdwkakcs%2Fsingtools/lists"}