[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-82304":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":9,"language":10,"languages":9,"totalLinesOfCode":9,"stars":11,"forks":12,"watchers":13,"openIssues":14,"contributorsCount":15,"subscribersCount":15,"size":15,"stars1d":15,"stars7d":16,"stars30d":17,"stars90d":15,"forks30d":15,"starsTrendScore":15,"compositeScore":18,"rankGlobal":9,"rankLanguage":9,"license":19,"archived":20,"fork":20,"defaultBranch":21,"hasWiki":22,"hasPages":20,"topics":23,"createdAt":9,"pushedAt":9,"updatedAt":24,"readmeContent":25,"aiSummary":26,"trendingCount":15,"starSnapshotCount":15,"syncStatus":16,"lastSyncTime":27,"discoverSource":28},82304,"SNI-balancer","hrostami\u002FSNI-balancer","hrostami","Periodically checks configs and chooses the most reliable one.",null,"Python",55,9,30,1,0,2,12,3,"Other",false,"main",true,[],"2026-06-12 02:04:25","# SNI-Balancer\n\u003Cimg width=\"1464\" height=\"891\" alt=\"Dashboard\" src=\"https:\u002F\u002Fgithub.com\u002Fuser-attachments\u002Fassets\u002F2374b29d-a258-48e0-81af-7bd827018dee\" \u002F>\n\nAn intelligent Xray config balancer for SNI-spoofing method.\n\nSNI-Balancer continuously benchmarks VLESS and Trojan configs using real latency and download speed tests, scores them based on performance history and stability, then automatically keeps the best config running through Xray as a LAN-accessible SOCKS5 proxy.\n\nNo GUI clients required. No manual switching. Fully automated.\n\n---\n\n# Features\n\n- Automatic Xray download and update\n- Automatic SNI-spoofing binary management\n- Supports both Rust and Go SNI-spoofing backends\n- Real-world speed testing through actual proxy traffic\n- Latency-aware scoring system\n- Historical stability tracking\n- Exponential backoff for dead configs\n- Automatic failover and recovery\n- Live dashboard\n- Subscription URL support\n- Cross-platform:\n  - Linux\n  - Windows\n  - macOS\n\n---\n\n# How It Works\n\n1. Reads configs from `configs.txt`\n2. Starts temporary isolated Xray instances for testing\n3. Performs:\n   - health checks\n   - latency measurement\n   - real download speed tests\n4. Calculates a weighted score using:\n   - speed\n   - latency\n   - historical stability\n5. Launches the highest-scoring config\n6. Continuously re-tests configs at configurable intervals\n7. Automatically switches only when improvement exceeds a threshold\n8. Persists history across restarts\n\n---\n\n# Supported Protocols\n\n| Protocol | Supported Transports |\n|---|---|\n| VLESS | WS, gRPC, xHTTP, HTTPUpgrade, SplitHTTP |\n| Trojan | WS, gRPC, xHTTP, HTTPUpgrade, SplitHTTP |\n\n\n---\n\n# Requirements\n\n- Python 3.9+\n- `curl`\n- Internet access\n- SNI-spoofing backend\n\n---\n\n# Installation\n\n## Clone the repository\n\n```bash\ngit clone https:\u002F\u002Fgithub.com\u002Fhrostami\u002Fsni-balancer.git\ncd sni-balancer\n```\n\n## Install dependencies\n\n```bash\npip install -r requirements.txt\n```\n\n## Create `configs.txt`\n\nSupports:\n- `vless:\u002F\u002F`\n- `trojan:\u002F\u002F`\n- Subscription URLs\n- Base64 subscriptions\n\nExample:\n\n```text\nvless:\u002F\u002Fuuid@host:port?...#MyConfig\ntrojan:\u002F\u002Fpassword@host:port?...#Server2\nhttps:\u002F\u002Fsubscription-url.example\u002Fsub\n```\n\n---\n\n# Running\n\n## Normal mode\n\n```bash\npython3 balancer.py\n```\n\n## Dry-run mode\n\nTests all configs without launching the final Xray instance.\n\n```bash\npython3 balancer.py --dry-run\n```\n\n## Custom interval\n\n```bash\npython3 balancer.py --interval 300\n```\n\n## Custom SOCKS5 port\n\n```bash\npython3 balancer.py --port 1080\n```\n\n## Larger speed test\n\n```bash\npython3 balancer.py --test-size 10\n```\n\n## Update Xray\n\n```bash\npython3 balancer.py --update-xray\n```\n\n---\n\n# Command Line Options\n\n| Argument | Description |\n|---|---|\n| `--dry-run` | Test configs only |\n| `--interval` | Seconds between test cycles |\n| `--configs` | Custom configs file |\n| `--port` | SOCKS5 listen port |\n| `--display-time` | Full dashboard display duration |\n| `--test-size` | Download test size in MB |\n| `--update-xray` | Download\u002Fupdate Xray |\n| `--sni-variant` | `rust` or `go` |\n| `--sni-connect` | Upstream address for SNI spoofing |\n| `--sni-fake` | Fake SNI hostname |\n\n---\n\n# SNI Spoofing\n\nThis project requires an external SNI-spoofing process.\n\nSupported implementations:\n- Rust backend\n- Go backend\n\nIf the binary is missing, SNI-Balancer can automatically download it.\n\nDefault values:\n\n```text\nConnect Address: 104.19.229.21:443\nFake SNI: hcaptcha.com\n```\n\n---\n\n# Scoring System\n\nEach config receives a weighted score:\n\n| Metric | Weight |\n|---|---|\n| Speed | 40% |\n| Stability | 30% |\n| Latency | 30% |\n\nThe balancer avoids unnecessary switching by requiring a minimum improvement threshold before changing the active config.\n\nRepeated failures trigger exponential backoff to avoid wasting resources on dead servers.\n\n---\n\n# Generated Files\n\n| File | Description |\n|---|---|\n| `xrayconfig.json` | Active Xray config |\n| `config_history.json` | Historical benchmark data |\n| `balancer.log` | Runtime logs |\n| `.xray_version` | Installed Xray version |\n\n---\n\n# Notes\n\n- The SOCKS5 proxy listens on all interfaces by default (`0.0.0.0`)\n- Temporary Xray instances are created during testing\n- Dead configs are skipped intelligently using exponential backoff\n- Xray is automatically relaunched if it crashes\n- Duplicate config names are automatically deduplicated\n- All generated files should remain ignored in Git\n\n---\n\n# Disclaimer\n\nThis project is intended for educational and research purposes.\n\nUse responsibly and comply with local laws and regulations.\n","SNI-Balancer 是一个智能的 Xray 配置均衡器，专门用于 SNI-spoofing 方法。它通过定期执行实际延迟和下载速度测试来评估 VLESS 和 Trojan 配置，并根据性能历史和稳定性评分，自动选择最优配置运行，作为局域网可访问的 SOCKS5 代理。项目支持 Rust 和 Go 的 SNI-spoofing 后端，具备自动更新 Xray 及其二进制文件、实时速度测试、基于历史稳定性的加权评分系统等功能。适用于需要稳定且高性能代理连接的场景，如跨地区网络访问、在线游戏或视频流媒体等，无需图形界面客户端，完全自动化操作，兼容 Linux、Windows 和 macOS 平台。","2026-06-11 04:08:18","CREATED_QUERY"]