modify ProxyParser interface

This commit is contained in:
2025-06-12 02:48:59 +10:00
parent 1b662de245
commit 4f3c2bb280
11 changed files with 87 additions and 22 deletions

View File

@ -11,6 +11,14 @@ import (
type AnytlsParser struct{}
func (p *AnytlsParser) SupportClash() bool {
return false
}
func (p *AnytlsParser) SupportMeta() bool {
return true
}
func (p *AnytlsParser) GetPrefixes() []string {
return []string{"anytls://"}
}

View File

@ -12,6 +12,14 @@ import (
type HysteriaParser struct{}
func (p *HysteriaParser) SupportClash() bool {
return false
}
func (p *HysteriaParser) SupportMeta() bool {
return true
}
func (p *HysteriaParser) GetPrefixes() []string {
return []string{"hysteria://"}
}

View File

@ -11,6 +11,14 @@ import (
type Hysteria2Parser struct{}
func (p *Hysteria2Parser) SupportClash() bool {
return false
}
func (p *Hysteria2Parser) SupportMeta() bool {
return true
}
func (p *Hysteria2Parser) GetPrefixes() []string {
return []string{"hysteria2://", "hy2://"}
}

View File

@ -16,6 +16,8 @@ type ProxyParser interface {
GetPrefixes() []string
// GetType 返回协议类型名称
GetType() string
SupportClash() bool
SupportMeta() bool
}
// parserRegistry 解析器注册中心

View File

@ -12,6 +12,14 @@ import (
// ShadowsocksParser Shadowsocks协议解析器
type ShadowsocksParser struct{}
func (p *ShadowsocksParser) SupportClash() bool {
return true
}
func (p *ShadowsocksParser) SupportMeta() bool {
return true
}
// GetPrefixes 返回支持的协议前缀
func (p *ShadowsocksParser) GetPrefixes() []string {
return []string{"ss://"}

View File

@ -11,6 +11,14 @@ import (
type ShadowsocksRParser struct{}
func (p *ShadowsocksRParser) SupportClash() bool {
return true
}
func (p *ShadowsocksRParser) SupportMeta() bool {
return true
}
func (p *ShadowsocksRParser) GetPrefixes() []string {
return []string{"ssr://"}
}

View File

@ -11,6 +11,13 @@ import (
type SocksParser struct{}
func (p *SocksParser) SupportClash() bool {
return true
}
func (p *SocksParser) SupportMeta() bool {
return true
}
func (p *SocksParser) GetPrefixes() []string {
return []string{"socks://"}
}

View File

@ -11,6 +11,14 @@ import (
type TrojanParser struct{}
func (p *TrojanParser) SupportClash() bool {
return true
}
func (p *TrojanParser) SupportMeta() bool {
return true
}
func (p *TrojanParser) GetPrefixes() []string {
return []string{"trojan://"}
}

View File

@ -11,6 +11,14 @@ import (
type VlessParser struct{}
func (p *VlessParser) SupportClash() bool {
return false
}
func (p *VlessParser) SupportMeta() bool {
return true
}
func (p *VlessParser) GetPrefixes() []string {
return []string{"vless://"}
}

View File

@ -12,6 +12,14 @@ import (
type VmessParser struct{}
func (p *VmessParser) SupportClash() bool {
return true
}
func (p *VmessParser) SupportMeta() bool {
return true
}
func (p *VmessParser) GetPrefixes() []string {
return []string{"vmess://"}
}