proxy

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package proxy provides parser utilities for various VPN proxy URLs (Shadowsocks, VMess, VLESS, Trojan). It has zero heavy dependencies and maps directly to the model.ProxyNode structure.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeIfBase64 added in v0.1.2

func DecodeIfBase64(raw string) string

DecodeIfBase64 checks if the input is a base64-encoded proxy URL and decodes it. If the input is already a plaintext proxy URL or cannot be decoded to one, it is returned as is.

func Format added in v0.1.1

func Format(node *model.ProxyNode) (*url.URL, error)

Format is a package-level helper that converts a model.ProxyNode into a *url.URL.

func FormatString added in v0.1.1

func FormatString(node *model.ProxyNode) (string, error)

FormatString is a package-level helper that converts a model.ProxyNode into its string URL representation.

Types

type Formatter added in v0.1.1

type Formatter struct{}

Formatter serializes a model.ProxyNode into a valid proxy URL.

func NewFormatter added in v0.1.1

func NewFormatter() *Formatter

NewFormatter creates a new Formatter instance.

func (*Formatter) Format added in v0.1.1

func (f *Formatter) Format(node *model.ProxyNode) (*url.URL, error)

Format converts a model.ProxyNode into a *url.URL structure.

func (*Formatter) FormatString added in v0.1.1

func (f *Formatter) FormatString(node *model.ProxyNode) (string, error)

FormatString converts a model.ProxyNode into its string URL representation.

type Parser

type Parser struct{}

Parser provides native proxy URL parsing without external dependencies.

func NewParser

func NewParser() *Parser

NewParser creates a new Parser instance.

func (*Parser) Parse

func (p *Parser) Parse(proxyURL string) (*model.ProxyNode, error)

Parse parses a proxy URL string into a ProxyNode. Supported schemes are: ss://, vmess://, vless://, and trojan://. If the proxyURL is base64-encoded, it will be automatically decoded.

Jump to

Keyboard shortcuts

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