decode

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2025 License: AGPL-3.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeBase64

func DecodeBase64(encoded string) (string, error)

DecodeBase64 decodes a base64 string, trying both standard and URL-safe encoding and adding padding if necessary

func ParseAnytls

func ParseAnytls(link string) (*configs.OutboundHandlerConfig, error)
func ParseHysteriaFromLink(link string) (*configs.OutboundHandlerConfig, error)

TODO: pinSHA256 hysteria2://letmein@example.com:123,5000-6000/?insecure=1&obfs= salamander&obfs-password=gawrgura&pinSHA256=deadbeef&sni=real.example.com

func ParseSocks5FromLink(link string) (*configs.OutboundHandlerConfig, error)
func ParseSsFromLink(link string) (*configs.OutboundHandlerConfig, error)

ParseSsFromLink parses a Shadowsocks configuration from a URI link

func ParseTrojan

func ParseTrojan(link string) (*configs.OutboundHandlerConfig, error)
func ParseVlessFromLink(link string) (*configs.OutboundHandlerConfig, error)

func TryParsePorts

func TryParsePorts(ports string) []*mynet.PortRange

TryParsePorts parses a string of ports in format "123,5000-6000" Returns a non-empty slice of PortRange if ports is valid, otherwise returns nil

Types

type DecodeResult

type DecodeResult struct {
	Configs     []*configs.OutboundHandlerConfig
	Description string
	FailedNodes []string
}

func Decode

func Decode(content string) (*DecodeResult, error)

Decode parses subscription content into outbound handler configurations

type SsConfig

type SsConfig struct {
	Cipher   string
	Password string
	Address  string
	Port     string
	Remark   string
}

SsConfig represents a Shadowsocks configuration

func ParseSsFromLink0

func ParseSsFromLink0(link string) (*SsConfig, error)

ParseSsFromLink parses a Shadowsocks configuration from a URI link

type VmessConfig

type VmessConfig struct {
	V    string      `json:"v,omitempty"`
	PS   string      `json:"ps,omitempty"`
	Add  string      `json:"add"`
	Port json.Number `json:"port"`
	ID   string      `json:"id,omitempty"`
	Aid  json.Number `json:"aid,omitempty"`
	Scy  string      `json:"scy,omitempty"`
	Net  string      `json:"net,omitempty"`
	Type string      `json:"type,omitempty"`
	Host string      `json:"host,omitempty"`
	Path string      `json:"path,omitempty"`
	TLS  string      `json:"tls,omitempty"`
	SNI  string      `json:"sni,omitempty"`
	ALPN string      `json:"alpn,omitempty"`
	FP   string      `json:"fp,omitempty"`
}

VmessConfig represents a Vmess protocol configuration

func ParseVmessFromJSON

func ParseVmessFromJSON(data []byte) (*VmessConfig, error)

ParseVmessFromJSON parses a VmessConfig from JSON

func (*VmessConfig) ToProxyHandlerConfig

func (v *VmessConfig) ToProxyHandlerConfig() (*configs.OutboundHandlerConfig, error)

ToProxyHandlerConfig converts VmessConfig to OutboundHandlerConfig

Jump to

Keyboard shortcuts

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