parser

package
v0.0.12-beta.2 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeBase64

func DecodeBase64(s string) (string, error)

func GetAllParsers

func GetAllParsers() map[string]ProxyParser

GetAllParsers 获取所有注册的解析器

func ParsePort

func ParsePort(portStr string) (int, error)

func ParseProxies

func ParseProxies(proxies ...string) []P.Proxy

func ParseProxyWithRegistry

func ParseProxyWithRegistry(proxy string) (P.Proxy, error)

ParseProxyWithRegistry 使用注册机制解析代理

func RegisterParser

func RegisterParser(parser ProxyParser)

RegisterParser 注册解析器

Types

type AnytlsParser

type AnytlsParser struct{}

func (*AnytlsParser) GetPrefixes

func (p *AnytlsParser) GetPrefixes() []string

func (*AnytlsParser) GetType

func (p *AnytlsParser) GetType() string

func (*AnytlsParser) Parse

func (p *AnytlsParser) Parse(proxy string) (P.Proxy, error)

func (*AnytlsParser) SupportClash

func (p *AnytlsParser) SupportClash() bool

func (*AnytlsParser) SupportMeta

func (p *AnytlsParser) SupportMeta() bool

type Hysteria2Parser

type Hysteria2Parser struct{}

func (*Hysteria2Parser) GetPrefixes

func (p *Hysteria2Parser) GetPrefixes() []string

func (*Hysteria2Parser) GetType

func (p *Hysteria2Parser) GetType() string

func (*Hysteria2Parser) Parse

func (p *Hysteria2Parser) Parse(proxy string) (P.Proxy, error)

func (*Hysteria2Parser) SupportClash

func (p *Hysteria2Parser) SupportClash() bool

func (*Hysteria2Parser) SupportMeta

func (p *Hysteria2Parser) SupportMeta() bool

type HysteriaParser

type HysteriaParser struct{}

func (*HysteriaParser) GetPrefixes

func (p *HysteriaParser) GetPrefixes() []string

func (*HysteriaParser) GetType

func (p *HysteriaParser) GetType() string

func (*HysteriaParser) Parse

func (p *HysteriaParser) Parse(proxy string) (P.Proxy, error)

func (*HysteriaParser) SupportClash

func (p *HysteriaParser) SupportClash() bool

func (*HysteriaParser) SupportMeta

func (p *HysteriaParser) SupportMeta() bool

type ProxyParser

type ProxyParser interface {
	// Parse 解析代理字符串并返回Proxy对象
	Parse(proxy string) (P.Proxy, error)
	// GetPrefix 返回支持的协议前缀(可以返回多个)
	GetPrefixes() []string
	// GetType 返回协议类型名称
	GetType() string
	SupportClash() bool
	SupportMeta() bool
}

ProxyParser 定义代理解析器接口

func GetParser

func GetParser(prefix string) (ProxyParser, bool)

GetParser 根据前缀获取解析器

type ShadowsocksParser

type ShadowsocksParser struct{}

ShadowsocksParser Shadowsocks协议解析器

func (*ShadowsocksParser) GetPrefixes

func (p *ShadowsocksParser) GetPrefixes() []string

GetPrefixes 返回支持的协议前缀

func (*ShadowsocksParser) GetType

func (p *ShadowsocksParser) GetType() string

GetType 返回协议类型

func (*ShadowsocksParser) Parse

func (p *ShadowsocksParser) Parse(proxy string) (P.Proxy, error)

Parse 解析Shadowsocks代理

func (*ShadowsocksParser) SupportClash

func (p *ShadowsocksParser) SupportClash() bool

func (*ShadowsocksParser) SupportMeta

func (p *ShadowsocksParser) SupportMeta() bool

type ShadowsocksRParser

type ShadowsocksRParser struct{}

func (*ShadowsocksRParser) GetPrefixes

func (p *ShadowsocksRParser) GetPrefixes() []string

func (*ShadowsocksRParser) GetType

func (p *ShadowsocksRParser) GetType() string

func (*ShadowsocksRParser) Parse

func (p *ShadowsocksRParser) Parse(proxy string) (P.Proxy, error)

func (*ShadowsocksRParser) SupportClash

func (p *ShadowsocksRParser) SupportClash() bool

func (*ShadowsocksRParser) SupportMeta

func (p *ShadowsocksRParser) SupportMeta() bool

type SocksParser

type SocksParser struct{}

func (*SocksParser) GetPrefixes

func (p *SocksParser) GetPrefixes() []string

func (*SocksParser) GetType

func (p *SocksParser) GetType() string

func (*SocksParser) Parse

func (p *SocksParser) Parse(proxy string) (P.Proxy, error)

func (*SocksParser) SupportClash

func (p *SocksParser) SupportClash() bool

func (*SocksParser) SupportMeta

func (p *SocksParser) SupportMeta() bool

type TrojanParser

type TrojanParser struct{}

func (*TrojanParser) GetPrefixes

func (p *TrojanParser) GetPrefixes() []string

func (*TrojanParser) GetType

func (p *TrojanParser) GetType() string

func (*TrojanParser) Parse

func (p *TrojanParser) Parse(proxy string) (P.Proxy, error)

func (*TrojanParser) SupportClash

func (p *TrojanParser) SupportClash() bool

func (*TrojanParser) SupportMeta

func (p *TrojanParser) SupportMeta() bool

type VlessParser

type VlessParser struct{}

func (*VlessParser) GetPrefixes

func (p *VlessParser) GetPrefixes() []string

func (*VlessParser) GetType

func (p *VlessParser) GetType() string

func (*VlessParser) Parse

func (p *VlessParser) Parse(proxy string) (P.Proxy, error)

func (*VlessParser) SupportClash

func (p *VlessParser) SupportClash() bool

func (*VlessParser) SupportMeta

func (p *VlessParser) SupportMeta() bool

type VmessParser

type VmessParser struct{}

func (*VmessParser) GetPrefixes

func (p *VmessParser) GetPrefixes() []string

func (*VmessParser) GetType

func (p *VmessParser) GetType() string

func (*VmessParser) Parse

func (p *VmessParser) Parse(proxy string) (P.Proxy, error)

func (*VmessParser) SupportClash

func (p *VmessParser) SupportClash() bool

func (*VmessParser) SupportMeta

func (p *VmessParser) SupportMeta() bool

Jump to

Keyboard shortcuts

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