Skip to content

A proxy gateway load balancer for VLESS/VMESS/Trojan traffic

Notifications You must be signed in to change notification settings

debugdoctor/shareport

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Shareport

A powerful proxy configuration manager with load balancing capabilities, featuring an interactive TUI interface, automatic certificate management, and flexible backend switching strategies.

Disclaimer

This project is for learning and personal use only. Do not use it for any illegal purposes.

Features

  • Pool-based Link Management: Organize backend proxy links into pools with different scheduling policies
  • Per-link Traffic Metadata: Store optional traffic quota (GB) and monthly reset schedule for each backend link
  • Multiple Scheduling Policies: Support for round-robin, random, and least-connection strategies
  • Proxy Config Generator: Interactive wizard to generate proxy configurations with VLESS/Trojan inbounds
  • Balancer Daemon: Scheduled backend switching with configurable intervals (fixed/random)
  • ACME Certificate Management: Automatic Let's Encrypt certificate issuance and renewal (HTTP-01/DNS-01)
  • TUI Interface: User-friendly terminal-based configuration management
  • i18n Support: Multi-language support (Chinese and English)
  • Runtime Management: Start/stop proxy and balancer daemon with ease

Notes:

  • Inbounds (generated by the wizard): vless, trojan
  • Backend links/outbounds (in pools): vless, vmess, trojan
  • Transports: the wizard supports tcp/ws/http/xhttp
  • Currently only tested with vless + tcp + none and vless + tcp + reality

Installation

Prerequisites

  • Go 1.25 or higher
  • Proxy binary (default: xray in PATH)

Build from Source

git clone https://github.com/aimerick/shareport.git
cd shareport
go build -o shareport

Release Builds (GitHub Actions)

Pushing a tag like v0.1.0 triggers a GitHub Actions workflow that builds per-platform binaries for Linux/macOS/Windows and attaches them to a GitHub Release.

git tag v0.1.0
git push origin v0.1.0

Release notes are generated via Release Drafter (based on PR labels) when you publish a tag release.

Quick Start

  1. Initialize Configuration
./shareport --init

This will launch an interactive wizard to set up your initial configuration.

  1. Run Shareport
./shareport

Usage

Command Line Options

Flag Description
--print-next Print next backend link and exit
--generate Interactive proxy config generator mode
--balancer-daemon Run balancer scheduler daemon (internal)
--db <path> SQLite database path (default: .shareport/shareport.db)
--init Force interactive init wizard to recreate config
--xray-config <path> Proxy config output path (default: .shareport/config.json)
--xray-bin <path> Proxy binary path or name (default: xray)
--lang <lang> Language (zh or en, default: zh)

Environment Variables

Variable Description
SHAREPORT_LANG Language preference (zh or en)

Configuration

Directory Structure

.shareport/
├── shareport.db          # SQLite database
├── config.json            # Generated proxy config
├── runtime.log            # Proxy logs
└── balancer-daemon.log   # Balancer daemon logs

Pool Configuration

A pool contains backend proxy links with a scheduling policy:

{
  "default_pool": "pool1",
  "pools": [
    {
      "name": "pool1",
      "policy": "round_robin",
      "links": [
        "vless://...",
        "vmess://...",
        "trojan://..."
      ]
    }
  ]
}

Supported Policies

  • round_robin: Rotate through links in order
  • random: Randomly select a link
  • least_conn: Select link with least active connections

TUI Menu

Main Menu

  1. View Current Config - Display current configuration
  2. Manage Pools - Add, delete, or set default pools
  3. Manage Backend Links - Add or remove links from pools
  4. Runtime Management - Start/stop proxy and balancer
  5. Regenerate Config - Interactive proxy config generator
  6. Renew Certificates - Renew ACME certificates
  7. Exit - Exit the program

Runtime Management

  • Balancer Manager: Start/stop balancer and scheduled switching
  • Change Scheduling Policy: Update pool scheduling strategies

Balancer Switching Strategies

The balancer supports multiple switching strategies:

Strategy Description
Off Default to node-1 (no switching)
Interval (Fixed) Switch at fixed time intervals (10-1800 seconds)
Interval (Random) Switch at random intervals within a range
Per Connection Trigger switching on each new connection (based on proxy access logs)

Certificate Management

Shareport supports automatic certificate issuance via ACME:

Supported Challenge Types

  • HTTP-01: Requires port 80 to be reachable
  • DNS-01: Manual DNS TXT record verification

Certificate Renewal

Use the "Renew Certificates" option in the main menu to renew expired certificates.

Development

Project Structure

shareport/
├── main.go              # Entry point and CLI flag parsing
├── cli/                 # TUI interface and wizards
├── components/          # ACME, link parsing, pool logic, metadata
├── config/              # Configuration and database handling
├── i18n/                # Internationalization
├── runtime/             # Runtime process management
├── ui/                  # TUI utilities
└── core/                # Proxy config generation

Database Schema

  • pools - Pool definitions (name, policy)
  • links - Backend links per pool (ordered by position)
  • settings - UI/generator configuration
  • runtime_state - Runtime state (PIDs, daemon status)

License

[Specify your license here]

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

About

A proxy gateway load balancer for VLESS/VMESS/Trojan traffic

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages