Release 1.3.0: Hysteria2 BBR/Salamander/masquerade options and subscription URL import.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
package hysteria2
|
||||
|
||||
import "vpnclient/internal/config"
|
||||
|
||||
// EnrichProfile fills empty hy2 option fields from the share URI.
|
||||
func EnrichProfile(p *config.Profile) {
|
||||
if p == nil || p.Protocol != config.ProtocolHysteria2 || p.Proxy == "" {
|
||||
return
|
||||
}
|
||||
ep, err := ParseEndpoint(p.Proxy)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
if p.Hy2SNI == "" {
|
||||
p.Hy2SNI = ep.SNI
|
||||
}
|
||||
if p.Hy2Obfs == "" {
|
||||
p.Hy2Obfs = ep.Obfs
|
||||
}
|
||||
if p.Hy2ObfsPassword == "" {
|
||||
p.Hy2ObfsPassword = ep.ObfsPassword
|
||||
}
|
||||
if p.Hy2PinSHA256 == "" {
|
||||
p.Hy2PinSHA256 = ep.PinSHA256
|
||||
}
|
||||
if ep.Insecure {
|
||||
p.Hy2Insecure = true
|
||||
}
|
||||
if p.Hy2Congestion == "" {
|
||||
p.Hy2Congestion = "bbr"
|
||||
}
|
||||
if p.Hy2BBRProfile == "" {
|
||||
p.Hy2BBRProfile = "standard"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user