sharx-code

command module
v2.0.0-...-dbcdbcc Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 30, 2026 License: GPL-3.0 Imports: 18 Imported by: 0

README

Welcome to SharX / Добро пожаловать в SharX

SharX is a modern multi-node Xray management platform with Docker-first deployment, observability hooks, and a visual subscription page builder.

SharX — современная multi-node платформа управления Xray с Docker-сборкой, наблюдаемостью и визуальным конструктором страницы подписки.

This version brings a modern, Docker-first architecture, multi-node workers, a visual subscription page builder, encrypted cookie-based web sessions, and optional observability hooks (Prometheus text metrics, optional Loki / VictoriaMetrics in settings, Grafana dashboard JSON export).

Эта версия даёт современную Docker-сборку, multi-node worker-узлы, визуальный конструктор страницы подписки, веб-сессии в зашифрованных cookie и опциональную наблюдаемость (метрики в формате Prometheus, опционально Loki/VictoriaMetrics в настройках, JSON дашборда для Grafana).

Quick Start / Быстрый старт

🚀 Install / Установка

Клонируйте и запустите:

git clone https://github.com/konstpic/SharX.git
cd SharX
sudo bash ./install_ru.sh

📜 Script Installation (Recommended) / Установка через скрипт (Рекомендуется)

Automatic Installation / Автоматическая установка

The install script supports multiple Linux distributions and automatically:

  • Installs Docker and Docker Compose
  • Configures network mode (host/bridge)
  • Sets up SSL certificates (Let's Encrypt for domain or IP)
  • Generates secure database password
  • Creates and starts all services

Скрипт установки поддерживает множество дистрибутивов Linux и автоматически:

  • Устанавливает Docker и Docker Compose
  • Настраивает режим сети (host/bridge)
  • Настраивает SSL сертификаты (Let's Encrypt для домена или IP)
  • Генерирует безопасный пароль базы данных
  • Создаёт и запускает все сервисы
Supported Systems / Поддерживаемые системы
Distribution Package Manager
Ubuntu/Debian apt
Fedora dnf
CentOS/RHEL yum
Arch Linux pacman
Alpine apk
openSUSE zypper
Panel Installation / Установка панели
sudo ./install.sh
# Select: 1) Install Panel
sudo ./install_ru.sh
# Выбрать: 1) Установить панель
Management Menu / Меню управления

After installation, run the script again to access the management menu:

После установки запустите скрипт снова для доступа к меню управления:

sudo ./install.sh

Menu options / Опции меню:

  • Update Panel / Обновить панель
  • Start/Stop/Restart services
  • Change ports
  • Renew SSL certificates
  • View logs and status

Panel updates / Обновление панели: Watchtower in the same stack + XUI_DOCKER_UPDATER_* (in-UI update), or docker compose pull + up -d, or the SharX script Update Panel (pulls sharx + watchtower). / Watchtower в стеке и UI, либо docker compose pull, либо 2) в install_*.sh. Set WATCHTOWER_HTTP_API_TOKEN in production. / WATCHTOWER_HTTP_API_TOKEN в .env для production. If you used build: in compose, the image name (e.g. sharx-code-sharx) is not pullable; use a Harbor image: and docker login — see README_RU/EN.

Remote nodes / Удалённые узлы: enable multi-node, add node and copy docker-compose.yml from the modal (PANEL_URL + SECRET_KEY pairing), then on the worker docker compose up -d --build. Manage in Nodes / Geography. Install script only deploys the panel. / Включите multi-node, в Нодах скопируйте compose из модалки, на узле — docker compose up -d --build. Подробно: node/README.md.


🔧 Manual Installation / Ручная установка

Panel Installation / Установка панели

  1. Clone the repository / Клонируйте репозиторий:

    git clone https://github.com/konstpic/SharX.git
    cd SharX
    
  2. Configure docker-compose.yml / Настройте docker-compose.yml:

    • Change change_this_password to a secure password
    • Измените change_this_password на надёжный пароль
    XUI_DB_PASSWORD: your_secure_password
    POSTGRES_PASSWORD: your_secure_password
    
  3. Prepare SSL certificates / Подготовьте SSL сертификаты:

    mkdir -p cert
    cp /path/to/fullchain.pem cert/fullchain.pem
    cp /path/to/privkey.pem cert/privkey.pem
    
  4. Start services / Запустите сервисы:

    docker compose up -d
    
  5. Access the panel / Откройте панель:

    http://your-server-ip:2053
    
  6. Configure TLS in panel settings / Настройте TLS в панели:

    • Certificate: /app/cert/fullchain.pem
    • Private Key: /app/cert/privkey.pem
  7. Remote nodes (optional) / Удалённые узлы (по желанию): multi-node + compose from the add node modal; see node/README.md. / Multi-node и docker-compose из модалки добавления узла — node/README.md.


Key Features / Основные возможности

  • Multi-node: One panel controls many worker nodes (REST node API, geography / host overrides)

  • PostgreSQL: Primary database with in-repo migrations; optional SQLite → PostgreSQL import for legacy panel backups

  • Encrypted cookie sessions: Standard stack uses signed/encrypted browser cookies (Gin session store)

  • Observability (optional): GET {basePath}panel/metrics (Prometheus text); optional Loki log push and VictoriaMetrics URL in panel settings; downloadable Grafana dashboard JSON for your stack (Grafana itself is not bundled by default)

  • Docker + Watchtower: Pre-built images; in-stack or manual updates

  • Subscription page builder: Block-based public subscription page (/panel/api/public/subscription) — see below

  • Xray core config profiles: Reusable core JSON merged into worker configs in multi-node mode

  • Telemt (MTProto): Sidecars on panel (standalone) and workers (multi-node), separate lifecycle from Xray where applicable

  • HWID (beta): Per-client device limits (Happ, V2RayTun)

  • Auto SSL: Let's Encrypt via install scripts / acme workflow

  • Environment-based config: Panel, sub, and DB settings via env (see full docs)

  • Multi-node: одна панель и множество worker-узлов (REST API узла, география / host overrides)

  • PostgreSQL: основная БД и миграции в репозитории; опциональный импорт SQLite → PostgreSQL со старых бэкапов панели

  • Сессии в cookie: веб-сессии в подписанных/зашифрованных cookie (Gin session store)

  • Наблюдаемость (опционально): GET {basePath}panel/metrics (текст Prometheus); опционально Loki и VictoriaMetrics в настройках панели; JSON дашборда для импорта в ваш Grafana (сам Grafana по умолчанию не входит в compose)

  • Docker + Watchtower: готовые образы; обновления из стека или вручную

  • Конструктор страницы подписки: блоковая публичная страница (/panel/api/public/subscription) — см. ниже

  • Профили конфига Xray (core): общий core JSON, мердж в конфиг worker в multi-node

  • Telemt (MTProto): sidecar на панели (single-node) и на worker; жизненный цикл отделён от Xray где задумано

  • HWID (бета): лимит устройств на клиента (Happ, V2RayTun)

  • Авто SSL: Let's Encrypt через скрипты установки / acme

  • Конфиг через env: панель, подписка, БД — см. полные README_EN/RU

Supported Protocols / Поддерживаемые протоколы

  • VMESS
  • VLESS
  • Trojan
  • Shadowsocks
  • Hysteria / Hysteria2
  • Mixed (SOCKS/HTTP)
  • WireGuard
  • HTTP/Tunnel (for specific transport and routing scenarios)
  • Telemt (MTProto sidecar integration for Telegram proxy flows)

Subscription Page Builder / Конструктор страницы подписки

SharX includes a built-in visual constructor for the public subscription page (/panel/api/public/subscription) with block-based layout and per-brand customization.

В SharX есть встроенный визуальный конструктор публичной страницы подписки (/panel/api/public/subscription) с блочной структурой и кастомизацией под бренд.

What you can configure / Что можно настраивать:

  • Branding and theme (title, logo, colors, locale)
  • Installation guides and app catalog (including Telegram MTProto flow when enabled)
  • Add-to-app buttons and deep links
  • Response rules (headers, profile metadata, announce/support links)
  • Custom HTML/content blocks and ordering
  • JSON templates and preview before publishing

Documentation / Документация

For detailed installation instructions, configuration, and migration guide, please see:

Для подробных инструкций по установке, настройке и миграции, пожалуйста, смотрите:

Requirements / Требования

  • Linux server (Ubuntu, Debian, CentOS, Fedora, Arch, Alpine, openSUSE)

  • Root access

  • Domain name (optional, for TLS with domain)

  • Port 80 open (for SSL certificate issuance)

  • Linux сервер (Ubuntu, Debian, CentOS, Fedora, Arch, Alpine, openSUSE)

  • Root доступ

  • Доменное имя (опционально, для TLS с доменом)

  • Открытый порт 80 (для выпуска SSL сертификата)

Support / Поддержка

For issues, questions, or contributions, please refer to the project repository.

По вопросам, проблемам или вкладу в проект обращайтесь в репозиторий проекта.

Authors / Авторы

Project Author / Автор проекта:

Donate / Донаты 💵

Support SharX development — card, crypto, and other payment methods:

Поддержите развитие SharX — карта, криптовалюта и другие способы оплаты:


Note: This version uses Docker containers for easy deployment. All images are pre-built and ready to use.

Примечание: Эта версия использует Docker-контейнеры для легкого развертывания. Все образы предварительно собраны и готовы к использованию.

Documentation

Overview

Package main is the entry point for the SharX web panel application. It initializes the database, web server, and handles command-line operations for managing the panel.

Directories

Path Synopsis
amneziawg
install
Package install builds or locates the AmneziaWG-go userspace binary for panel/node images.
Package install builds or locates the AmneziaWG-go userspace binary for panel/node images.
Package config provides configuration management utilities for the SharX panel, including version information, logging levels, database connection, and environment variable handling.
Package config provides configuration management utilities for the SharX panel, including version information, logging levels, database connection, and environment variable handling.
Package database provides database initialization, migration, and management utilities for the SharX panel using GORM with PostgreSQL.
Package database provides database initialization, migration, and management utilities for the SharX panel using GORM with PostgreSQL.
model
Package model defines the database models and data structures used by the SharX panel.
Package model defines the database models and data structures used by the SharX panel.
Package logger provides logging functionality for the SharX panel with dual-backend logging (console/syslog and file) and buffered log storage for web UI.
Package logger provides logging functionality for the SharX panel with dual-backend logging (console/syslog and file) and buffered log storage for web UI.
Package main is the entry point for the SharX node service (worker).
Package main is the entry point for the SharX node service (worker).
amneziawg
Package amneziawg runs AmneziaWG-go sidecar processes on the SharX panel/node host.
Package amneziawg runs AmneziaWG-go sidecar processes on the SharX panel/node host.
api
Package api provides REST API endpoints for the node service.
Package api provides REST API endpoints for the node service.
auth
Package auth loads the node SECRET_KEY used for JWT and HMAC auth with the panel.
Package auth loads the node SECRET_KEY used for JWT and HMAC auth with the panel.
config
Package config provides node configuration persistence (panel URL, node address).
Package config provides node configuration persistence (panel URL, node address).
configpull
Package configpull fetches Xray configuration from the panel on worker startup (HMAC pairing).
Package configpull fetches Xray configuration from the panel on worker startup (HMAC pairing).
defaults
Package defaults holds node service defaults (host-network worker).
Package defaults holds node service defaults (host-network worker).
geopush
Package geopush sends one-shot egress geolocation from the worker to the panel (HMAC, pairing).
Package geopush sends one-shot egress geolocation from the worker to the panel (HMAC, pairing).
logs
Package logs provides log pushing functionality for sending logs from node to panel in real-time.
Package logs provides log pushing functionality for sending logs from node to panel in real-time.
telemt
Package telemt runs Telemt (MTProto) sidecar processes on the SharX node.
Package telemt runs Telemt (MTProto) sidecar processes on the SharX node.
xray
Package xray provides XRAY Core management for the node service.
Package xray provides XRAY Core management for the node service.
Package sub — Clash YAML subscription converter.
Package sub — Clash YAML subscription converter.
telemt
install
Package install downloads official Telemt release binaries from github.com/telemt/telemt.
Package install downloads official Telemt release binaries from github.com/telemt/telemt.
util
common
Package common provides common utility functions for error handling, formatting, and multi-error management.
Package common provides common utility functions for error handling, formatting, and multi-error management.
crypto
Package crypto provides cryptographic utilities for password hashing and verification.
Package crypto provides cryptographic utilities for password hashing and verification.
dockerupdater
Package dockerupdater calls an optional HTTP sidecar (e.g.
Package dockerupdater calls an optional HTTP sidecar (e.g.
geoip
Package geoip resolves public egress IP and approximate lat/lon using public HTTP APIs (chain with fallbacks).
Package geoip resolves public egress IP and approximate lat/lon using public HTTP APIs (chain with fallbacks).
json_util
Package json_util provides JSON utilities including a custom RawMessage type.
Package json_util provides JSON utilities including a custom RawMessage type.
pairing_outbound
Package pairing_outbound signs node→panel requests with a shared symmetric key.
Package pairing_outbound signs node→panel requests with a shared symmetric key.
random
Package random provides utilities for generating random strings and numbers.
Package random provides utilities for generating random strings and numbers.
reflect_util
Package reflect_util provides reflection utilities for working with struct fields and values.
Package reflect_util provides reflection utilities for working with struct fields and values.
sys
Package sys provides system utilities for monitoring network connections and CPU usage.
Package sys provides system utilities for monitoring network connections and CPU usage.
web
Package web provides the panel static filesystem and helpers for the Next.js export.
Package web provides the panel static filesystem and helpers for the Next.js export.
controller
Package controller provides HTTP request handlers and controllers for the SharX web management panel.
Package controller provides HTTP request handlers and controllers for the SharX web management panel.
entity
Package entity defines data structures and entities used by the web layer of the SharX panel.
Package entity defines data structures and entities used by the web layer of the SharX panel.
global
Package global provides global variables and interfaces for accessing web and subscription servers.
Package global provides global variables and interfaces for accessing web and subscription servers.
job
Package job provides scheduled tasks for monitoring client HWIDs from access logs.
Package job provides scheduled tasks for monitoring client HWIDs from access logs.
locale
Package locale provides internationalization (i18n) support for the SharX web panel, including translation loading, localization, and middleware for web and bot interfaces.
Package locale provides internationalization (i18n) support for the SharX web panel, including translation loading, localization, and middleware for web and bot interfaces.
logsse
Package logsse provides a Server-Sent Events hub for real-time log streaming.
Package logsse provides a Server-Sent Events hub for real-time log streaming.
middleware
Package middleware provides HTTP middleware functions for the SharX web panel, including domain validation and URL redirection utilities.
Package middleware provides HTTP middleware functions for the SharX web panel, including domain validation and URL redirection utilities.
network
Package network provides network utilities for the SharX web panel, including automatic HTTP to HTTPS redirection functionality.
Package network provides network utilities for the SharX web panel, including automatic HTTP to HTTPS redirection functionality.
service
Package service provides Client management service.
Package service provides Client management service.
session
Package session provides session management utilities for the SharX web panel.
Package session provides session management utilities for the SharX web panel.
websocket
Package websocket provides WebSocket hub for real-time updates and notifications.
Package websocket provides WebSocket hub for real-time updates and notifications.
Package xray provides integration with the Xray proxy core.
Package xray provides integration with the Xray proxy core.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL