link

package
v1.5.0 Latest Latest
Warning

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

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

Documentation

Overview

Package link builds client share-links from a user + settings.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Custom added in v1.5.0

func Custom(u model.User, in model.Inbound, set *model.Settings) string

Custom builds the share link for one operator-defined inbound, or "" for a protocol that has no link form. The three protocols each map to their own scheme and credential: VLESS carries the UUID, Trojan and Hysteria2 the password.

func CustomLabel added in v1.5.0

func CustomLabel(in model.Inbound, set *model.Settings) string

CustomLabel is the node name a custom inbound shows in the client: the operator's own name for it, prefixed with the server label on a multi-node install so two servers' inbounds never read as one.

func Hysteria2

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

Hysteria2 builds a hysteria2:// share link.

Format matches what x-ui/3x-ui and similar Xray-based panels emit and that clients such as v2rayNG / NekoBox (Xray core) accept:

hysteria2://<pw>@<host>:<port>?type=hysteria&security=tls&sni=<sni>
      &alpn=h3&fm=<quicParams>#<label>

func Label

func Label(proto string, set *model.Settings) string

Label is the node name appended after '#' in share links / used as the sing-box/Clash node tag. It's the admin-configured custom name for the protocol, or the default protocol label when unset (see Settings.ProtoLabel). The user name, when requested, goes into the subscription title instead (see sub.SubTitle).

func Reality

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

Reality builds a vless:// share link for VLESS + XHTTP + REALITY.

vless://<uuid>@<host>:<port>?encryption=none&security=reality&type=xhttp
      &path=<path>&mode=auto&pbk=<pub>&sid=<sid>&sni=<dest>&fp=<fp>#<label>

mode stays "auto" on purpose: with a REALITY config present Xray's client resolves auto to stream-one (one HTTP request per connection), which is both the smallest surface and what the server side expects. Pinning a different mode here would only make the two disagree.

func VLESS

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

VLESS builds a vless:// share link for raw-TCP + TLS + Vision.

vless://<uuid>@<host>:<port>?encryption=none&security=tls&sni=<sni>
      &fp=chrome&type=tcp&flow=xtls-rprx-vision#<label>

Types

This section is empty.

Jump to

Keyboard shortcuts

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