Sing2

module
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2026 License: GPL-3.0

README

Sing2

Sing2 re-implements XrayR (a multi-tenant proxy billing backend) on a single sing-box fork core (base: shtorm-7/sing-box-extended@v1.13.14-extended-2.5.2, used via a replace of github.com/sagernet/sing-box), dropping xray-core entirely, and wires the base's built-in Mieru and TrustTunnel inbounds into its translation layer. It keeps XrayR's business value — panel sync, per-user rate/device/online limits, audit, traffic accounting, cert automation, hot reload — but swaps the engine.

Panel integration is SSpanel/mod_mu only (2026-07-22 decision). The target new panel is Phoenix, which speaks XrayR's sspanel/mod_mu wire format. Sing2 additionally ports the local XrayR fork's access-log reporting (AccessLog) subsystem (POST /mod_mu/users/accesslog).

Status: Phase 0 (scaffolding). The full development plan lives under doc/; the design contracts are doc/09doc/11. This repository currently ships the plan plus the Phase 0 skeleton (compilable module, Core interface freeze, minimal VLESS inbound for the baseline smoke).

Build

Requires Go 1.26.4+ (the base fork's go.mod declares go 1.26.4; the toolchain auto-downloads if your local Go is older).

make build      # -> ./sing2, with the locked build-tag set
make test vet   # unit tests + go vet
make lint fmt   # golangci-lint + gofmt/goimports

The locked build-tag set is with_utls with_quic (REALITY/uTLS + hysteria2/tuic transports); with_clash_api is intentionally not required — Sing2's billing tracker mounts via Router.AppendTracker independently of the clash/v2ray api (doc/02 §4.2, doc/11 §2.1).

Phase 0 baseline smoke
./sing2 run --uuid <UUID> --port 16602 --flow xtls-rprx-vision

Starts a native VLESS inbound; connect with an Xray-core client (v2rayNG / xray) to validate cross-core interop (the project's #1 verification item, DoD-7).

License

SPDX-License-Identifier: GPL-3.0-or-later

Sing2 is a derivative work of a sing-box fork and links GPL-3.0 protocol engines built into that base (Mieru via enfein/mieru/v3, TrustTunnel). The whole binary is therefore distributed under GPL-3.0-or-later; the full text is in LICENSE.

The base fork shtorm-7/sing-box-extended is itself GPL-3.0 (sing-box upstream). Some linked libraries (the sagernet/sing family, redirected to shtorm-7 forks) and the ported XrayR logic (billing/limiter, billing/rule, billing/accesslog) were MPL-2.0 upstream and are redistributed under GPL as part of the whole, retaining their upstream per-file headers (see NOTICE).

Complete corresponding source (this repository plus the exact fork commit pinned in go.mod/go.sum) accompanies any binary distribution, satisfying GPLv3 §6. Third-party components and their licenses are listed in THIRD_PARTY_LICENSES.md.

Base-fork tracking

Day-to-day builds trust only the base tag pinned in go.mod; fork upgrades go through an isolated PR (change go.mod/go.sum only) that must pass CI + a re-run of the baseline smoke before merge. See doc/08-risks-and-maintenance.md.

Directories

Path Synopsis
api
billing
accesslog
Package accesslog buffers, batches and reports access-log entries to the panel, per node.
Package accesslog buffers, batches and reports access-log entries to the panel, per node.
limiter
Package limiter is to control the links that go into the dispatcher
Package limiter is to control the links that go into the dispatcher
ratelimit
Package ratelimit wraps connections with a token-bucket rate limiter.
Package ratelimit wraps connections with a token-bucket rate limiter.
rule
Package rule matches audit (banned-word/domain) regexes and produces DetectResult (ported from XrayR common/rule).
Package rule matches audit (banned-word/domain) regexes and produces DetectResult (ported from XrayR common/rule).
stats
Package stats provides the engine-neutral per-user up/down byte counter and conn wrapper (Hinge B).
Package stats provides the engine-neutral per-user up/down byte counter and conn wrapper (Hinge B).
Package cert automates certificates via sing-box certificate_provider (ACME) with file/none fallback.
Package cert automates certificates via sing-box certificate_provider (ACME) with file/none fallback.
cmd
sing2 command
Package panel orchestrates multiple nodes, periodic panel tasks and hot reload.
Package panel orchestrates multiple nodes, periodic panel tasks and hot reload.
protocol
mieru
Package mieru provides Sing2's Mieru inbound — a drop-in replacement for the base fork's, adding the hot user updates the base cannot do (doc/13 T6).
Package mieru provides Sing2's Mieru inbound — a drop-in replacement for the base fork's, adding the hot user updates the base cannot do (doc/13 T6).
trusttunnel
Package trusttunnel wraps the TrustTunnel service as a sing-box inbound.
Package trusttunnel wraps the TrustTunnel service as a sing-box inbound.
Package serverstatus 采集本机的系统负载指标(CPU/内存/磁盘/运行时长), 供 panel 的 ReportNodeStatus 周期上报使用。
Package serverstatus 采集本机的系统负载指标(CPU/内存/磁盘/运行时长), 供 panel 的 ReportNodeStatus 周期上报使用。

Jump to

Keyboard shortcuts

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