mirror of
https://github.com/nitezs/sub2sing-box.git
synced 2024-12-23 10:44:41 -05:00
fix: hy2 parser
This commit is contained in:
parent
e89c70dd85
commit
0681136d65
@ -55,6 +55,7 @@ func ParseHysteria(proxy string) (model.Outbound, error) {
|
||||
|
||||
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")
|
||||
insecureBool, err := strconv.ParseBool(insecure)
|
||||
enableTLS := insecureBool || alpnStr != ""
|
||||
if err != nil {
|
||||
insecureBool = false
|
||||
}
|
||||
@ -86,7 +87,7 @@ func ParseHysteria(proxy string) (model.Outbound, error) {
|
||||
Network: option.NetworkList(protocol),
|
||||
OutboundTLSOptionsContainer: option.OutboundTLSOptionsContainer{
|
||||
TLS: &option.OutboundTLSOptions{
|
||||
Enabled: true,
|
||||
Enabled: enableTLS,
|
||||
Insecure: insecureBool,
|
||||
ALPN: alpn,
|
||||
},
|
||||
|
@ -55,9 +55,16 @@ func ParseHysteria2(proxy string) (model.Outbound, 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 != ""
|
||||
network, obfs, obfsPassword, pinSHA256, insecure, sni, alpnStr := query.Get("network"), query.Get("obfs"), query.Get("obfs-password"), query.Get("pinSHA256"), query.Get("insecure"), query.Get("sni"), query.Get("alpn")
|
||||
insecureBool := insecure == "1"
|
||||
enableTLS := pinSHA256 != "" || sni != "" || alpnStr != ""
|
||||
|
||||
var alpn []string
|
||||
alpnStr = strings.TrimSpace(alpnStr)
|
||||
if alpnStr != "" {
|
||||
alpn = strings.Split(alpnStr, ",")
|
||||
}
|
||||
|
||||
remarks := link.Fragment
|
||||
if remarks == "" {
|
||||
remarks = fmt.Sprintf("%s:%s", server, portStr)
|
||||
@ -79,6 +86,7 @@ func ParseHysteria2(proxy string) (model.Outbound, error) {
|
||||
Enabled: enableTLS,
|
||||
Insecure: insecureBool,
|
||||
ServerName: sni,
|
||||
ALPN: alpn,
|
||||
},
|
||||
},
|
||||
Network: option.NetworkList(network),
|
||||
|
Loading…
Reference in New Issue
Block a user