Skip to content

Commit cecd52e

Browse files
committed
update
1 parent 15f22bc commit cecd52e

File tree

5 files changed

+115
-75
lines changed

5 files changed

+115
-75
lines changed

infra/conf/transport_internet.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -412,8 +412,9 @@ type TLSConfig struct {
412412
MasterKeyLog string `json:"masterKeyLog"`
413413
ServerNameToVerify string `json:"serverNameToVerify"`
414414
VerifyPeerCertInNames []string `json:"verifyPeerCertInNames"`
415-
ECHConfigList string `json:"echConfigList"`
416415
ECHServerKeys string `json:"echServerKeys"`
416+
ECHConfigList string `json:"echConfigList"`
417+
ECHForceQuery bool `json:"echForceQuery"`
417418
ECHSocketSettings *SocketConfig `json:"echSockopt"`
418419
}
419420

@@ -486,16 +487,15 @@ func (c *TLSConfig) Build() (proto.Message, error) {
486487
}
487488
config.VerifyPeerCertInNames = c.VerifyPeerCertInNames
488489

489-
config.EchConfigList = c.ECHConfigList
490-
491490
if c.ECHServerKeys != "" {
492491
EchPrivateKey, err := base64.StdEncoding.DecodeString(c.ECHServerKeys)
493492
if err != nil {
494493
return nil, errors.New("invalid ECH Config", c.ECHServerKeys)
495494
}
496495
config.EchServerKeys = EchPrivateKey
497496
}
498-
497+
config.EchForceQuery = c.ECHForceQuery
498+
config.EchConfigList = c.ECHConfigList
499499
if c.ECHSocketSettings != nil {
500500
ss, err := c.ECHSocketSettings.Build()
501501
if err != nil {

transport/internet/tls/config.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"crypto/tls"
99
"crypto/x509"
1010
"encoding/base64"
11+
"github.com/xtls/xray-core/features/dns"
1112
"os"
1213
"slices"
1314
"strings"
@@ -450,7 +451,11 @@ func (c *Config) GetTLSConfig(opts ...Option) *tls.Config {
450451
if len(c.EchConfigList) > 0 || len(c.EchServerKeys) > 0 {
451452
err := ApplyECH(c, config)
452453
if err != nil {
453-
errors.LogError(context.Background(), err)
454+
if c.EchForceQuery || errors.Cause(err) != dns.ErrEmptyResponse {
455+
errors.LogError(context.Background(), err)
456+
} else {
457+
errors.LogInfo(context.Background(), err)
458+
}
454459
}
455460
}
456461

transport/internet/tls/config.pb.go

Lines changed: 37 additions & 26 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

transport/internet/tls/config.proto

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,11 @@ message Config {
9494
*/
9595
repeated string verify_peer_cert_in_names = 17;
9696

97-
string ech_config_list = 18;
97+
bytes ech_server_keys = 18;
9898

99-
bytes ech_server_keys = 19;
99+
string ech_config_list = 19;
100100

101-
SocketConfig ech_socket_settings = 20;
101+
bool ech_force_query = 20;
102+
103+
SocketConfig ech_socket_settings = 21;
102104
}

0 commit comments

Comments
 (0)