sub

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2026 License: AGPL-3.0 Imports: 13 Imported by: 0

Documentation

Overview

Package sub builds the per-user subscription: the machine payload consumed by VPN clients and the human-facing page (QR + one-tap import buttons).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Base64Payload

func Base64Payload(links []string) string

Base64Payload is the universal v2ray-style subscription body: the links joined by newlines, base64-encoded. Consumed by v2rayNG, Hiddify, Streisand, NekoBox, Shadowrocket, etc.

func ClashWithTemplate

func ClashWithTemplate(u model.User, set *model.Settings, template string) string

ClashWithTemplate injects the user's proxies into a RoscomVPN-style Mihomo routing template. The template carries two "# LEAVE THIS LINE!" markers: the `proxies:` line (full proxy definitions) and a slot inside the main select group (proxy node names). Falls back to the plain config if the template has no proxies marker.

func ClashYAML

func ClashYAML(u model.User, set *model.Settings) string

ClashYAML renders a minimal self-contained Clash-Meta (Mihomo) configuration: the user's proxies plus a single select group and a catch-all rule.

func Logo() []byte

Logo returns the embedded РосПанель logo (SVG).

func Page

func Page(u model.User, set *model.Settings) ([]byte, error)

Page renders the human-facing subscription page (usage stats, QR of the sub URL, copy button, per-client import buttons, and the raw links).

func ShareLinks(u model.User, set *model.Settings) []string

ShareLinks returns the enabled protocol links for a user, in client-import order. Protocols switched off in the Connections panel are omitted.

func SingBoxJSON

func SingBoxJSON(u model.User, set *model.Settings) string

SingBoxJSON renders an importable sing-box configuration (current 1.11+ schema) with a tun inbound, the enabled protocol outbounds, an auto urltest + manual selector, and a minimal route. Targeted at official SFA/SFI/SFM clients; other sing-box-based clients (Hiddify, NekoBox) consume the base64 list instead.

func SubTitle

func SubTitle(u model.User, set *model.Settings) string

SubTitle is the per-user profile title: the configured subscription title (or «РосПанель» by default), optionally suffixed with the user name when SubNameInTitle is enabled.

func URL

func URL(set *model.Settings, token string) string

URL is the public subscription URL for a token (always https on the host).

Types

type DeepLink struct {
	Label    string
	Platform string
	Href     template.URL
}

DeepLink is one "open in client" button. Href is template.URL so html/template keeps the custom client schemes (happ://, v2rayng://, …) instead of sanitizing them to "#ZgotmplZ". Platform notes which OS the client targets.

func DeepLinks(subURL string) []DeepLink

DeepLinks builds best-effort import deep-links for the popular clients, most popular first. Schemes drift across client releases — verify periodically.

Jump to

Keyboard shortcuts

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