Skip to content

Commit

Permalink
chg: no utls if fingerprint is not set
Browse files Browse the repository at this point in the history
  • Loading branch information
hiddify-com committed Aug 4, 2024
1 parent e5ba91d commit f340989
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
12 changes: 7 additions & 5 deletions ray2sing/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,15 @@ func getTLSOptions(decoded map[string]string) T.OutboundTLSOptionsContainer {
Enabled: true,
ServerName: serverName,
Insecure: decoded["insecure"] == "true",
// DisableSNI: serverName == "",
UTLS: &option.OutboundUTLSOptions{
DisableSNI: serverName == "",
ECH: ECHOpts,
TLSTricks: getTricksOptions(decoded),
}
if fp != "" &&!tlsOptions.DisableSNI{
tlsOptions.UTLS = &option.OutboundUTLSOptions{
Enabled: true,
Fingerprint: fp,
},
ECH: ECHOpts,
TLSTricks: getTricksOptions(decoded),
}
}

if alpn, ok := decoded["alpn"]; ok && alpn != "" {
Expand Down
16 changes: 8 additions & 8 deletions ray2sing/xray_common.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func getTLSOptionsXray(decoded map[string]string) map[string]any {
return map[string]any{
"serverName": serverName,
"rejectUnknownSni": false,
"allowInsecure": decoded["insecure"] == "true",
"allowInsecure": decoded["insecure"] == "true" || decoded["insecure"] == "1",
"alpn": alpn,
// "minVersion": "1.2",
// "maxVersion": "1.3",
Expand Down Expand Up @@ -170,29 +170,29 @@ func getStreamSettingsXray(decoded map[string]string) (map[string]any, error) {
// net = "http"
// }
res := map[string]any{}

res["network"] = net
switch net {
case "tcp":
res[net+"Settings"] = map[string]any{}
decoded["alpn"]="http/1.1"
decoded["alpn"] = "http/1.1"
case "httpupgrade":
res[net+"Settings"] = gethttpupgrade(decoded)
decoded["alpn"]="http/1.1"
decoded["alpn"] = "http/1.1"
case "ws":
res[net+"Settings"] = getwebsocket(decoded)
decoded["alpn"]="http/1.1"
decoded["alpn"] = "http/1.1"
case "grpc":
res[net+"Settings"] = getgrpc(decoded)
decoded["alpn"]="h2"
decoded["alpn"] = "h2"
case "quic":
res[net+"Settings"] = getquic(decoded)
decoded["alpn"]="h3"
decoded["alpn"] = "h3"
case "splithttp":
res[net+"Settings"] = getsplithttp(decoded)
case "h2":
res[net+"Settings"] = geth2(decoded)
decoded["alpn"]="h2"
decoded["alpn"] = "h2"
default:
return nil, E.New("unknown transport type: " + net)
}
Expand Down

0 comments on commit f340989

Please sign in to comment.