link

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2026 License: AGPL-3.0 Imports: 4 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 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>

fm carries the port-hopping quicParams JSON and is double-URL-encoded because Xray decodes query params twice before consuming the value. The JSON is kept COMPACT (no spaces/newlines): Go's url.QueryEscape encodes a space as "+", which after the second encode becomes "%2B" and decodes back to a literal "+" on the client — corrupting the JSON. No whitespace ⇒ no ambiguity.

func Label

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

Label is the node name appended after '#' in share links / used as the sing-box/Clash node tag: the protocol on its own, or "<protocol>_<user>" when SubEmailInName is enabled (protocol names contain dashes, so the user name is joined with an underscore).

func Reality

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

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

vless://<uuid>@<host>:<port>?encryption=none&security=reality&type=grpc
      &serviceName=<svc>&mode=gun&pbk=<pub>&sid=<sid>&sni=<dest>&fp=<fp>#<label>

func Trojan

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

Trojan builds a trojan:// share link for Trojan-over-WebSocket on :443.

trojan://<password>@<host>:443?security=tls&sni=<sni>&type=ws
      &path=<wspath>&host=<sni>&fp=chrome#<label>

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