Enhance Trojan, Vless, and Vmess parsers.

This commit is contained in:
2025-07-01 02:06:33 +08:00
parent b256c5e809
commit b44703fa0f
3 changed files with 56 additions and 32 deletions

View File

@ -99,6 +99,13 @@ func (p *VmessParser) Parse(proxy string) (P.Proxy, error) {
name = vmess.Ps
}
var alpn []string
if strings.Contains(vmess.Alpn, ",") {
alpn = strings.Split(vmess.Alpn, ",")
} else {
alpn = nil
}
result := P.Vmess{
Server: vmess.Add,
Port: port,
@ -107,19 +114,22 @@ func (p *VmessParser) Parse(proxy string) (P.Proxy, error) {
Cipher: vmess.Scy,
}
if vmess.Tls == "tls" {
var alpn []string
if strings.Contains(vmess.Alpn, ",") {
alpn = strings.Split(vmess.Alpn, ",")
} else {
alpn = nil
}
result.TLS = true
result.Fingerprint = vmess.Fp
if len(alpn) > 0 {
result.ALPN = alpn
}
if vmess.Fp != "" {
result.ClientFingerprint = vmess.Fp
}
if vmess.Sni != "" {
result.ServerName = vmess.Sni
}
if vmess.Tls == "tls" {
result.TLS = true
}
if vmess.Net == "ws" {
if vmess.Path == "" {
vmess.Path = "/"