An open API service indexing awesome lists of open source software.

https://github.com/ahaoboy/crash

A Rust-based proxy core management tool supporting Clash/Mihomo/SingBox and other proxy cores. This is a Rust port of ShellCrash.
https://github.com/ahaoboy/crash

clash mihomo openwrt rust shellclash singbox

Last synced: about 1 month ago
JSON representation

A Rust-based proxy core management tool supporting Clash/Mihomo/SingBox and other proxy cores. This is a Rust port of ShellCrash.

Awesome Lists containing this project

README

          

# Crash

A Rust-based proxy core management tool supporting Clash/Mihomo/SingBox and other proxy cores. This is a Rust port of [ShellCrash](https://github.com/juewuy/ShellCrash).

## Features

- 🚀 Cross-platform support (Linux, macOS, Windows, Android)
- 📦 Automatic download and installation of proxy cores
- 🔄 Automatic configuration and GeoIP database updates
- 🌐 Multiple Web UI support (Metacubexd, Yacd)
- ⏰ Scheduled task support (automatic config and database updates)
- 🔧 Flexible configuration management
- 🪞 Multiple GitHub mirror support for accelerated downloads


crash

## Installation

### Quick Install

Install with a single command using the installation script:

```bash
bash <(curl -fsSL https://raw.githubusercontent.com/ahaoboy/crash/main/install.sh)
```

### Using Proxy for Faster Downloads

If GitHub access is slow, use a mirror:

```bash
# Using gh-proxy mirror
bash <(curl -fsSL https://raw.githubusercontent.com/ahaoboy/crash/main/install.sh) --proxy gh-proxy

curl -fsSL https://gh-proxy.com/https://github.com/ahaoboy/crash/blob/main/install.sh | sh -s -- --proxy gh-proxy
curl -fsSL https://xget.xi-xu.me/gh/ahaoboy/crash/raw/refs/heads/main/install.sh | sh -s -- --proxy xget

# Using xget mirror
bash <(curl -fsSL https://raw.githubusercontent.com/ahaoboy/crash/main/install.sh) --proxy xget

# Using jsdelivr CDN
bash <(curl -fsSL https://raw.githubusercontent.com/ahaoboy/crash/main/install.sh) --proxy jsdelivr
```

### crash-assets

https://github.com/ahaoboy/crash-assets

```bash
curl -fsSL https://cdn.jsdelivr.net/gh/ahaoboy/crash-assets@main/install.sh | sh -s -- --proxy jsdelivr

curl -fsSL https://gh-proxy.com/https://github.com/ahaoboy/crash-assets/blob/main/install.sh | sh -s -- --proxy gh-proxy

curl -fsSL https://cdn.statically.io/gh/ahaoboy/crash-assets/main/install.sh | sh -s -- --proxy statically

curl -fsSL https://xget.xi-xu.me/gh/ahaoboy/crash-assets/raw/refs/heads/main/install.sh | sh -s -- --proxy xget
```

### asusrouter

```bash

curl -fsSL https://gh-proxy.com/https://github.com/ahaoboy/crash-assets/blob/main/install.sh | sh -s -- --proxy gh-proxy --dir /jffs

```

### Custom Installation Directory

```bash
export EI_DIR=~/.local/bin
bash <(curl -fsSL https://raw.githubusercontent.com/ahaoboy/crash/main/install.sh)
```

### Build from Source

```bash
# Clone the repository
git clone https://github.com/ahaoboy/crash.git
cd crash

# Build
cargo build --release

# Install
cargo install --path .
```

## Usage

### Initialize and Install

```bash
# Install all components (core, ui, geo, task)
crash install

# Force reinstallation of all
crash install -f

# Install specific components
crash install core # Install proxy core only
crash install ui # Install web UI only
crash install geo # Install GeoIP databases only
crash install task # Install scheduled tasks only

# Force install specific component
crash install -f core
```

### Service Control

```bash
# Start proxy service
crash start

# Stop proxy service
crash stop

# Check service status
crash status
```

### Configuration Management (config subcommand)

All configuration options are now unified under the `config` subcommand:

```bash
# View all configuration as JSON
crash config

# Configuration URL
crash config url # Show current URL
crash config url # Set configuration URL (support URL or local path)

# GitHub download proxy
crash config proxy # Show current proxy
crash config proxy gh-proxy # Set proxy (direct, gh-proxy, xget, jsdelivr, etc.)

# Web UI type
crash config ui # Show current UI
crash config ui metacubexd # Set UI (metacubexd, yacd)
# Web controller host
crash config host # Show current host
crash config host :9090 # Set host

# Web controller secret
crash config secret # Show current secret
crash config secret # Set secret

# Target platform
crash config target # Show current target
crash config target x86_64-unknown-linux-musl # Set target

# Other common targets
crash config target aarch64-unknown-linux-musl # ARM64 Linux (musl)
crash config target x86_64-unknown-linux-gnu # x86_64 Linux (gnu)
crash config target aarch64-unknown-linux-gnu # ARM64 Linux (gnu)
crash config target x86_64-pc-windows-msvc # Windows x64
crash config target aarch64-apple-darwin # macOS Apple Silicon
crash config target x86_64-apple-darwin # macOS Intel

# Maximum runtime (hours, 0 = disabled)
crash config max-runtime # Show current max-runtime
crash config max-runtime 24 # Set max-runtime to 24 hours
crash config max-runtime 0 # Disable automatic restart
```

### Scheduled Tasks

```bash
# Install scheduled tasks (via install subcommand)
crash install task

# Manually run scheduled task
crash run-task

# Remove scheduled tasks
crash remove-task
```

### Self-Upgrade

```bash
crash upgrade
```

### Shell Completions

Generate shell completion scripts for auto-completion:

```bash
# Bash - Add to your shell profile
crash completions bash > ~/.local/share/bash-completion/completions/crash
# Or source directly
source <(crash completions bash)

# Fish - Install to fish completions directory
crash completions fish > ~/.config/fish/completions/crash.fish

# Zsh
crash completions zsh > "${fpath[1]}/_crash"

# PowerShell
crash completions powershell >> $PROFILE

# Elvish
crash completions elvish > ~/.config/elvish/lib/crash.elv
```

### ei

```bash

crash ei ahaoboy/coreutils-build --name mktemp

crash ei ilai-deutel/kibi --proxy gh-proxy

```

## Configuration File

Configuration file location:
- Linux/macOS: `~/.crash/config.json`
- Windows: `%USERPROFILE%\.crash\config.json`

Example configuration:

```json
{
"url": "https://example.com/config.yaml",
"proxy": "Direct",
"web": {
"ui": "Metacubexd",
"host": ":9090",
"secret": "your-secret"
}
}
```

## Supported Platforms

- Linux (x86_64, aarch64, armv7, i686) - musl/gnu
- macOS (x86_64, aarch64/Apple Silicon)
- Windows (x86_64, i686, aarch64)
- Android (aarch64, armv7, x86_64, i686)

## Scheduled Tasks

After installing scheduled tasks, the system will automatically:

- **Every Wednesday at 3:00 AM**: Update configuration files and GeoIP databases
- **Every 10 minutes**: Check and start proxy service (if not running)

### Linux/macOS (crontab)

```cron
0 3 * * 3 ~/.crash/crash run-task
*/10 * * * * ~/.crash/crash start
```

### Windows (Task Scheduler)

- `CrashRunTask`: Runs every Wednesday at 03:00
- `CrashStart`: Runs every 10 minutes

## Logging

Log files location:
- Linux/macOS: `~/.crash/logs/`
- Windows: `%USERPROFILE%\.crash\logs\`

Logs are automatically rotated, keeping the last 5 files with a maximum size of 10MB each.

## Development

### Building

```bash
# Development build
cargo build

# Release build
cargo build --release

# Run tests
cargo test
```

## License

MIT License - see [LICENSE](LICENSE) file for details

## Acknowledgments

- [ShellCrash](https://github.com/juewuy/ShellCrash) - Original project
- [Clash](https://github.com/Dreamacro/clash) - Proxy core
- [Mihomo](https://github.com/MetaCubeX/mihomo) - Clash fork
- [SingBox](https://github.com/SagerNet/sing-box) - Universal proxy platform

## Contributing

Issues and Pull Requests are welcome!

## Links

- [GitHub Repository](https://github.com/ahaoboy/crash)
- [Issue Tracker](https://github.com/ahaoboy/crash/issues)