vless

package
v0.2.0-dev.15 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2026 License: AGPL-3.0 Imports: 18 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package vless is the panel half of the VLESS protocol plugin. It offers REALITY over TCP (RAW + Vision) and XHTTP, plus XHTTP+TLS and WebSocket+TLS through the node's TLS front.

Index

Constants

View Source
const ID = "vless"

ID is the plugin id.

Variables

This section is empty.

Functions

This section is empty.

Types

type CDNSettings added in v0.1.36

type CDNSettings struct {
	Host string `json:"host"`
	Port int    `json:"port,omitempty"`
}

type ClientParams added in v0.1.37

type ClientParams struct {
	Host, UUID, Flow, Security, SNI, Fingerprint string
	PublicKey, ShortID, SpiderX                  string
	Transport, ClientHost                        string
	XHTTPPath, XHTTPMode, XHTTPPadding           string
	XHTTPExtra                                   string
	WSPath                                       string
	Port                                         uint16
	ALPN                                         []string
}

ClientParams are the effective VLESS settings a client consumes after profile and per-credential values are resolved. Both subscription renderers and the panel's synthetic client use this result.

func ResolveClientParams added in v0.1.37

func ResolveClientParams(in protocols.RenderInput) (ClientParams, bool)

ResolveClientParams checks the inputs a client link depends on and makes the per-credential picks: the REALITY server name and short id are chosen by fnv32(device id), so the bytes of a subscription stay the same from one fetch to the next. XHTTP and WebSocket ALPN follow the node's TLS front; the URI format leaves those defaults implicit.

type NodeCDN added in v0.1.36

type NodeCDN struct {
	Host string `json:"host"`
}

type NodeReality

type NodeReality struct {
	Target      string   `json:"target"`
	ServerNames []string `json:"server_names"`
	ShortIDs    []string `json:"short_ids"`
	PrivateKey  string   `json:"private_key"`
}

type NodeSettings

type NodeSettings struct {
	Transport string        `json:"transport"`
	Security  string        `json:"security"`
	Flow      string        `json:"flow"`
	CDN       *NodeCDN      `json:"cdn,omitempty"`
	Reality   NodeReality   `json:"reality"`
	XHTTP     NodeXHTTP     `json:"xhttp"`
	WS        NodeWebSocket `json:"ws"`
}

NodeSettings is the deterministic settings_json contract consumed by internal/node/vless.parseSpec. Field order is kept in sync with the node wireSettings type.

type NodeWebSocket

type NodeWebSocket struct {
	Path string `json:"path"`
	Host string `json:"host"`
}

type NodeXHTTP

type NodeXHTTP struct {
	Path          string `json:"path"`
	Host          string `json:"host"`
	Mode          string `json:"mode"`
	XPaddingBytes string `json:"x_padding_bytes"`
}

type Protocol

type Protocol struct{}

Protocol implements protocols.Protocol, InboundInitializer and SettingsNormalizer.

func New

func New() *Protocol

func (*Protocol) BuildInbound

func (*Protocol) BuildInbound(in protocols.InboundInput) (plugin.InboundSpec, error)

BuildInbound lifts the TCP listen port, TLS certificate and egress out of settings. The node receives only the origin fields needed to build the TLS front; the CDN endpoint stays in the panel profile for client rendering.

func (*Protocol) Clients

func (*Protocol) Clients() []plugin.ClientSupport

func (*Protocol) DefaultSettings

func (*Protocol) DefaultSettings() (json.RawMessage, error)

DefaultSettings leaves out what must differ from one profile to the next: the short ids and the XHTTP path. The panel UI keeps these defaults for the whole session, so a value drawn here would be shared by every profile made in it; NormalizeSettings draws them when a profile is made, the way the AmneziaWG plugin does for its obfuscation block.

func (*Protocol) DisplayName

func (*Protocol) DisplayName() string

func (*Protocol) Doctor

func (*Protocol) Doctor() []protocols.Check

func (*Protocol) ID

func (*Protocol) ID() string

func (*Protocol) InitInbound

InitInbound generates an X25519 REALITY key pair for this inbound. State is the private key; Public is safe to include in client configurations. The access framework parks State when an inbound is removed and restores it when that same profile is added back to the node.

func (*Protocol) IssueCredential

func (*Protocol) IssueCredential(protocols.IssueInput) (protocols.Issued, error)

IssueCredential makes the UUID v4 VLESS uses as both the client secret and its node-side identity.

func (*Protocol) NormalizeSettings

func (*Protocol) NormalizeSettings(in protocols.NormalizeInput) (json.RawMessage, error)

NormalizeSettings draws the short ids (one of 8 and one of 16 hex characters) and the XHTTP path of a profile that has none. A document that gives a target and does not say what kind it is (a script written for the panel before the node could serve its own site) means another site, as it always did: the default "self" would otherwise drop its target in silence. It returns Merged itself when there is nothing to change.

func (*Protocol) Render

func (*Protocol) SettingsSchema

func (*Protocol) SettingsSchema() []byte

func (*Protocol) Summary

func (*Protocol) Summary(raw json.RawMessage) string

func (*Protocol) Validate

func (*Protocol) Validate(raw json.RawMessage) []protocols.FieldError

type RealitySettings

type RealitySettings struct {
	// TargetKind is self or site. A document that predates the field (a profile made before the node could serve its own
	// site) carries a target and no kind: it reads as site, see kind().
	TargetKind  string   `json:"target_kind"`
	Target      string   `json:"target"`
	ServerNames []string `json:"server_names"`
	ShortIDs    []string `json:"short_ids"`
	Fingerprint string   `json:"fingerprint"`
}

type Settings

type Settings struct {
	Port      int             `json:"port"`
	Transport string          `json:"transport"`
	Security  string          `json:"security"`
	TLSMode   string          `json:"tls_mode,omitempty"`
	SNI       string          `json:"sni,omitempty"`
	CDN       *CDNSettings    `json:"cdn,omitempty"`
	Reality   RealitySettings `json:"reality"`
	XHTTP     XHTTPSettings   `json:"xhttp"`
	WS        *WSSettings     `json:"ws,omitempty"`
	Egress    string          `json:"egress"`
}

Settings is the merged profile settings document. Private keys are per inbound and never live here.

type WSSettings added in v0.1.36

type WSSettings struct {
	Path string `json:"path"`
	Host string `json:"host"`
}

type XHTTPSettings

type XHTTPSettings struct {
	Path          string `json:"path"`
	Host          string `json:"host"`
	Mode          string `json:"mode"`
	XPaddingBytes string `json:"x_padding_bytes"`
}

Jump to

Keyboard shortcuts

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