links

package
v0.0.0-...-618b1d7 Latest Latest
Warning

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

Go to latest
Published: May 10, 2026 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Overview

Package links generates share links and JSON outbound configs from generated sing-box configurations and cheburbox schemas.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateLinks(projectRoot string, jpath string, filter Filter, format Format) ([]string, error)

GenerateLinks produces share links or JSON outbound configs for all matching inbounds.

func Hysteria2Link(info InboundInfo) string

Hysteria2Link builds a hysteria2:// share URI from the given inbound info.

func Hysteria2OutboundJSON

func Hysteria2OutboundJSON(info InboundInfo) (string, error)

Hysteria2OutboundJSON builds a sing-box Hysteria2 outbound JSON config.

func VLESSLink(info InboundInfo) string

VLESSLink builds a vless:// share URI from the given inbound info.

func VLESSOutboundJSON

func VLESSOutboundJSON(info InboundInfo) (string, error)

VLESSOutboundJSON builds a sing-box VLESS outbound JSON config.

Types

type Filter

type Filter struct {
	Server  string
	User    string
	Inbound string
}

Filter restricts which links are generated.

type Format

type Format string

Format specifies the output format for generated links.

const (
	// FormatURI produces protocol share URIs (vless://, hysteria2://).
	FormatURI Format = "uri"
	// FormatJSON produces sing-box outbound JSON configs.
	FormatJSON Format = "json"
)

type InboundInfo

type InboundInfo struct {
	// Common fields.
	Server     string
	Endpoint   string
	Tag        string
	Type       string // "vless" or "hysteria2".
	ListenPort uint16
	UserName   string
	// VLESS-specific.
	UUID    string
	Flow    string
	Reality *RealityInfo
	// Hysteria2-specific.
	Password     string
	PinSHA256    string
	ObfsType     string
	ObfsPassword string
	// Common TLS.
	ServerName string
	ALPN       []string
}

InboundInfo holds all data needed to build a share link for one user on one inbound.

func CollectInboundInfos

func CollectInboundInfos(projectRoot string, jpath string, filter Filter) ([]InboundInfo, error)

CollectInboundInfos gathers link data for all matching server/inbound/user combinations under projectRoot.

type RealityInfo

type RealityInfo struct {
	PublicKey string
	ShortID   string
	SNI       string
}

RealityInfo holds VLESS Reality TLS parameters.

Jump to

Keyboard shortcuts

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