1
0
mirror of https://github.com/nitezs/sub2sing-box.git synced 2024-12-24 12:44:42 -05:00

update: vless,vmess parser

This commit is contained in:
Nite07 2024-03-21 00:59:47 +08:00 committed by Nite07
parent 1a7944f7a1
commit f545848ce1
2 changed files with 22 additions and 35 deletions

View File

@ -71,32 +71,22 @@ func ParseVless(proxy string) (model.Outbound, error) {
TLS: &model.OutboundTLSOptions{ TLS: &model.OutboundTLSOptions{
Enabled: true, Enabled: true,
ALPN: alpn, ALPN: alpn,
ServerName: params.Get("sni"),
Insecure: params.Get("allowInsecure") == "1", Insecure: params.Get("allowInsecure") == "1",
}, },
} }
if params.Get("fp") != "" {
result.VLESSOptions.OutboundTLSOptionsContainer.TLS.UTLS = &model.OutboundUTLSOptions{
Enabled: true,
Fingerprint: params.Get("fp"),
}
}
} }
if params.Get("security") == "reality" { if params.Get("security") == "reality" {
var alpn []string result.VLESSOptions.OutboundTLSOptionsContainer.TLS.Reality = &model.OutboundRealityOptions{
if strings.Contains(params.Get("alpn"), ",") {
alpn = strings.Split(params.Get("alpn"), ",")
} else {
alpn = nil
}
result.VLESSOptions.OutboundTLSOptionsContainer = model.OutboundTLSOptionsContainer{
TLS: &model.OutboundTLSOptions{
Enabled: true,
ServerName: params.Get("sni"),
UTLS: &model.OutboundUTLSOptions{
Enabled: params.Get("fp") != "",
Fingerprint: params.Get("fp"),
},
Reality: &model.OutboundRealityOptions{
Enabled: true, Enabled: true,
PublicKey: params.Get("pbk"), PublicKey: params.Get("pbk"),
ShortID: params.Get("sid"), ShortID: params.Get("sid"),
},
ALPN: alpn,
},
} }
} }
if params.Get("type") == "ws" { if params.Get("type") == "ws" {
@ -115,11 +105,6 @@ func ParseVless(proxy string) (model.Outbound, error) {
Type: "quic", Type: "quic",
QUICOptions: model.V2RayQUICOptions{}, QUICOptions: model.V2RayQUICOptions{},
} }
result.VLESSOptions.OutboundTLSOptionsContainer = model.OutboundTLSOptionsContainer{
TLS: &model.OutboundTLSOptions{
Enabled: true,
},
}
} }
if params.Get("type") == "grpc" { if params.Get("type") == "grpc" {
result.VLESSOptions.Transport = &model.V2RayTransportOptions{ result.VLESSOptions.Transport = &model.V2RayTransportOptions{

View File

@ -80,8 +80,15 @@ func ParseVmess(proxy string) (model.Outbound, error) {
Fingerprint: vmess.Fp, Fingerprint: vmess.Fp,
}, },
ALPN: alpn, ALPN: alpn,
ServerName: vmess.Sni,
}, },
} }
if vmess.Fp != "" {
result.VMessOptions.OutboundTLSOptionsContainer.TLS.UTLS = &model.OutboundUTLSOptions{
Enabled: true,
Fingerprint: vmess.Fp,
}
}
} }
if vmess.Net == "ws" { if vmess.Net == "ws" {
@ -108,11 +115,6 @@ func ParseVmess(proxy string) (model.Outbound, error) {
Type: "quic", Type: "quic",
QUICOptions: quic, QUICOptions: quic,
} }
result.VMessOptions.OutboundTLSOptionsContainer = model.OutboundTLSOptionsContainer{
TLS: &model.OutboundTLSOptions{
Enabled: true,
},
}
} }
if vmess.Net == "grpc" { if vmess.Net == "grpc" {