mirror of
https://github.com/nitezs/sub2sing-box.git
synced 2024-12-23 21:34:41 -05:00
⚡️ Remove redundant fields from results
This commit is contained in:
parent
7b61aa1b26
commit
5395417a31
@ -260,7 +260,10 @@ func ConvertSubscriptionsToSProxy(urls []string) ([]model.Outbound, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
proxy, err := util.DecodeBase64(data)
|
proxy := data
|
||||||
|
if !strings.Contains(data, "://") {
|
||||||
|
proxy, err = util.DecodeBase64(data)
|
||||||
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -54,7 +54,7 @@ func ParseHysteria2(proxy string) (model.Outbound, error) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
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")
|
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 != ""
|
enableTLS := pinSHA256 != "" || sni != ""
|
||||||
insecureBool := insecure == "1"
|
insecureBool := insecure == "1"
|
||||||
remarks := link.Fragment
|
remarks := link.Fragment
|
||||||
if remarks == "" {
|
if remarks == "" {
|
||||||
@ -71,18 +71,24 @@ func ParseHysteria2(proxy string) (model.Outbound, error) {
|
|||||||
ServerPort: port,
|
ServerPort: port,
|
||||||
},
|
},
|
||||||
Password: password,
|
Password: password,
|
||||||
Obfs: &model.Hysteria2Obfs{
|
|
||||||
Type: obfs,
|
|
||||||
Password: obfsPassword,
|
|
||||||
},
|
|
||||||
OutboundTLSOptionsContainer: model.OutboundTLSOptionsContainer{
|
OutboundTLSOptionsContainer: model.OutboundTLSOptionsContainer{
|
||||||
TLS: &model.OutboundTLSOptions{Enabled: enableTLS,
|
TLS: &model.OutboundTLSOptions{
|
||||||
Insecure: insecureBool,
|
Enabled: enableTLS,
|
||||||
ServerName: sni,
|
Insecure: insecureBool,
|
||||||
Certificate: []string{pinSHA256}},
|
ServerName: sni,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
Network: network,
|
Network: network,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
if pinSHA256 != "" {
|
||||||
|
result.Hysteria2Options.OutboundTLSOptionsContainer.TLS.Certificate = []string{pinSHA256}
|
||||||
|
}
|
||||||
|
if obfs != "" {
|
||||||
|
result.Hysteria2Options.Obfs = &model.Hysteria2Obfs{
|
||||||
|
Type: obfs,
|
||||||
|
Password: obfsPassword,
|
||||||
|
}
|
||||||
|
}
|
||||||
return result, nil
|
return result, nil
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user