Skip to content

nowaytouse/v2rayn-config-manager

Repository files navigation

Sing-box Manager

Cross-platform Sing-box and Mihomo configuration management and core auto-update tool. Pure Rust CLI implementation.

English | 中文


Features

Dual Core Update

  • sing-box - Direct download from GitHub releases
  • mihomo - Direct download from GitHub releases (MetaCubeX/mihomo)
  • Stable and prerelease version support
  • Auto backup before replacement

Subscription Management

  • Multiple subscription sources
  • Auto-refresh on schedule
  • Custom save paths per subscription

Update Modes

  • Interactive - Menu-driven CLI interface
  • One-time - Single update and exit
  • Scheduled - Background auto-update (configurable interval)

Platform Support

  • macOS (darwin/amd64, darwin/arm64)
  • Linux (linux/amd64, linux/arm64)
  • Windows (windows/amd64)

Quick Start

# Build
cargo build --release

# Interactive mode (menu-driven)
./target/release/singbox-manager --interactive

# One-time update (non-interactive)
./target/release/singbox-manager --once

# Custom config file
./target/release/singbox-manager -c /path/to/config.json --once

# Show version
./target/release/singbox-manager --version

Configuration

Create config.json:

{
  "subscriptions": [
    {
      "name": "My Subscription",
      "url": "https://your-subscription-url",
      "save_path": "/path/to/config.json"
    }
  ],
  "update_interval_hours": 24,
  "singbox_core_update": {
    "enabled": true,
    "install_path": "/usr/local/bin/sing-box",
    "check_prerelease": false
  },
  "mihomo_core_update": {
    "enabled": true,
    "install_paths": [
      "/usr/local/bin/mihomo",
      "/opt/homebrew/bin/mihomo"
    ],
    "check_prerelease": true
  }
}

Configuration Options

Field Description
subscriptions List of subscription sources
subscriptions[].name Display name
subscriptions[].url Subscription URL
subscriptions[].save_path Where to save the config
update_interval_hours Auto-update interval (hours)
singbox_core_update.enabled Enable sing-box core updates
singbox_core_update.install_path Installation path
singbox_core_update.check_prerelease Use prerelease versions
mihomo_core_update.enabled Enable mihomo core updates
mihomo_core_update.install_paths List of installation paths
mihomo_core_update.check_prerelease Use prerelease (Alpha) versions

CLI Options

singbox-manager [OPTIONS]

-i, --interactive    Interactive menu mode
-c, --config <FILE>  Config file path (default: config.json)
-o, --once           Execute update once and exit
-v, --version        Show version information

Security Note

⚠️ config.json contains sensitive subscription URLs - never commit to Git!

# Use example config
cp config.example.json config.json
# Edit with your settings

How It Works

Core Update Process

  1. Check latest version via GitHub redirect (no API rate limit for stable)
  2. Download platform-specific binary (tar.gz for sing-box, gz for mihomo)
  3. Extract to temporary directory
  4. Backup existing binary (if exists)
  5. Install new binary with correct permissions
  6. Cleanup temporary files

Subscription Update Process

  1. Fetch subscription URL
  2. Parse and validate config
  3. Save to configured path
  4. Repeat for all subscriptions

功能特性

双核心更新

  • sing-box - 从 GitHub releases 直接下载
  • mihomo - 从 GitHub releases 直接下载 (MetaCubeX/mihomo)
  • 支持稳定版和预发布版
  • 替换前自动备份

订阅管理

  • 多订阅源支持
  • 定时自动刷新
  • 每个订阅可配置独立保存路径

更新模式

  • 交互式 - 菜单驱动的 CLI 界面
  • 一次性 - 单次更新后退出
  • 定时 - 后台自动更新(可配置间隔)

平台支持

  • macOS (darwin/amd64, darwin/arm64)
  • Linux (linux/amd64, linux/arm64)
  • Windows (windows/amd64)

快速开始

# 编译
cargo build --release

# 交互模式(菜单驱动)
./target/release/singbox-manager --interactive

# 一次性更新(非交互)
./target/release/singbox-manager --once

# 自定义配置文件
./target/release/singbox-manager -c /path/to/config.json --once

# 显示版本
./target/release/singbox-manager --version

配置说明

创建 config.json

{
  "subscriptions": [
    {
      "name": "我的订阅",
      "url": "https://your-subscription-url",
      "save_path": "/path/to/config.json"
    }
  ],
  "update_interval_hours": 24,
  "singbox_core_update": {
    "enabled": true,
    "install_path": "/usr/local/bin/sing-box",
    "check_prerelease": false
  },
  "mihomo_core_update": {
    "enabled": true,
    "install_paths": [
      "/usr/local/bin/mihomo",
      "/opt/homebrew/bin/mihomo"
    ],
    "check_prerelease": true
  }
}

配置选项

字段 说明
subscriptions 订阅源列表
subscriptions[].name 显示名称
subscriptions[].url 订阅 URL
subscriptions[].save_path 配置保存路径
update_interval_hours 自动更新间隔(小时)
singbox_core_update.enabled 启用 sing-box 核心更新
singbox_core_update.install_path 安装路径
singbox_core_update.check_prerelease 使用预发布版本
mihomo_core_update.enabled 启用 mihomo 核心更新
mihomo_core_update.install_paths 安装路径列表
mihomo_core_update.check_prerelease 使用预发布 (Alpha) 版本

安全提示

⚠️ config.json 包含敏感的订阅 URL,切勿提交到 Git!

# 使用示例配置
cp config.example.json config.json
# 编辑你的设置

MIT License

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published