Unify parts of the model with MetaCubeX.

This commit is contained in:
2025-06-12 14:19:00 +10:00
parent 0c8bbac2e6
commit f88ae52a29
24 changed files with 590 additions and 353 deletions

View File

@ -85,7 +85,7 @@ func (p *AnytlsParser) Parse(proxy string) (P.Proxy, error) {
Server: server,
Port: port,
Password: password,
Sni: sni,
SNI: sni,
SkipCertVerify: insecureBool,
},
}

View File

@ -69,7 +69,7 @@ func (p *HysteriaParser) Parse(proxy string) (P.Proxy, error) {
query := link.Query()
protocol, auth, insecure, upmbps, downmbps, obfs, alpnStr := query.Get("protocol"), query.Get("auth"), query.Get("insecure"), query.Get("upmbps"), query.Get("downmbps"), query.Get("obfs"), query.Get("alpn")
protocol, auth, auth_str, insecure, upmbps, downmbps, obfs, alpnStr := query.Get("protocol"), query.Get("auth"), query.Get("auth-str"), query.Get("insecure"), query.Get("upmbps"), query.Get("downmbps"), query.Get("obfs"), query.Get("alpn")
insecureBool, err := strconv.ParseBool(insecure)
if err != nil {
insecureBool = false
@ -96,11 +96,11 @@ func (p *HysteriaParser) Parse(proxy string) (P.Proxy, error) {
Up: upmbps,
Down: downmbps,
Auth: auth,
AuthString: auth_str,
Obfs: obfs,
SkipCertVerify: insecureBool,
Alpn: alpn,
ALPN: alpn,
Protocol: protocol,
AllowInsecure: insecureBool,
},
}
return result, nil

View File

@ -70,8 +70,7 @@ func (p *Hysteria2Parser) Parse(proxy string) (P.Proxy, error) {
Raw: portStr,
}
}
network, obfs, obfsPassword, pinSHA256, insecure, sni := query.Get("network"), query.Get("obfs"), query.Get("obfs-password"), query.Get("pinSHA256"), query.Get("insecure"), query.Get("sni")
enableTLS := pinSHA256 != "" || sni != ""
obfs, obfsPassword, insecure, sni := query.Get("obfs"), query.Get("obfs-password"), query.Get("insecure"), query.Get("sni")
insecureBool := insecure == "1"
remarks := link.Fragment
if remarks == "" {
@ -87,11 +86,9 @@ func (p *Hysteria2Parser) Parse(proxy string) (P.Proxy, error) {
Port: port,
Password: password,
Obfs: obfs,
ObfsParam: obfsPassword,
Sni: sni,
ObfsPassword: obfsPassword,
SNI: sni,
SkipCertVerify: insecureBool,
TLS: enableTLS,
Network: network,
},
}
return result, nil

View File

@ -91,7 +91,7 @@ func (p *SocksParser) Parse(proxy string) (P.Proxy, error) {
Socks: P.Socks{
Server: server,
Port: port,
Username: username,
UserName: username,
Password: password,
},
}, nil

View File

@ -91,14 +91,12 @@ func (p *TrojanParser) Parse(proxy string) (P.Proxy, error) {
}
if security == "xtls" || security == "tls" {
result.Alpn = alpn
result.Sni = sni
result.TLS = true
result.ALPN = alpn
result.SNI = sni
}
if security == "reality" {
result.TLS = true
result.Sni = sni
result.SNI = sni
result.RealityOpts = P.RealityOptions{
PublicKey: pbk,
ShortID: sid,

View File

@ -84,15 +84,14 @@ func (p *VlessParser) Parse(proxy string) (P.Proxy, error) {
if security == "tls" {
result.TLS = true
result.Alpn = alpn
result.Sni = sni
result.AllowInsecure = insecureBool
result.ALPN = alpn
result.SkipCertVerify = insecureBool
result.ClientFingerprint = fp
}
if security == "reality" {
result.TLS = true
result.Servername = sni
result.ServerName = sni
result.RealityOpts = P.RealityOptions{
PublicKey: pbk,
ShortID: sid,

View File

@ -119,8 +119,8 @@ func (p *VmessParser) Parse(proxy string) (P.Proxy, error) {
}
result.TLS = true
result.Fingerprint = vmess.Fp
result.Alpn = alpn
result.Servername = vmess.Sni
result.ALPN = alpn
result.ServerName = vmess.Sni
}
if vmess.Net == "ws" {