mirror of
https://github.com/XTLS/Xray-core.git
synced 2024-11-23 17:11:28 +00:00
Skip if not go1.23
This commit is contained in:
parent
4c7ca8beff
commit
d7c2c33547
2
go.mod
2
go.mod
|
@ -1,6 +1,6 @@
|
|||
module github.com/xtls/xray-core
|
||||
|
||||
go 1.23
|
||||
go 1.21.4
|
||||
|
||||
require (
|
||||
github.com/OmarTariq612/goech v0.0.0-20240405204721-8e2e1dafd3a0
|
||||
|
|
|
@ -391,11 +391,10 @@ func (c *Config) GetTLSConfig(opts ...Option) *tls.Config {
|
|||
}
|
||||
}
|
||||
if len(c.EchConfig) > 0 {
|
||||
ECHConfig, err := base64.StdEncoding.DecodeString(c.EchConfig)
|
||||
err := ApplyECH(c, config)
|
||||
if err != nil {
|
||||
errors.LogError(context.Background(), "invalid ECH config")
|
||||
errors.LogError(context.Background(), err)
|
||||
}
|
||||
config.EncryptedClientHelloConfigList = ECHConfig
|
||||
}
|
||||
|
||||
return config
|
||||
|
|
21
transport/internet/tls/ech.go
Normal file
21
transport/internet/tls/ech.go
Normal file
|
@ -0,0 +1,21 @@
|
|||
//go:build go1.23
|
||||
// +build go1.23
|
||||
|
||||
package tls
|
||||
|
||||
import (
|
||||
"context"
|
||||
"crypto/tls"
|
||||
"encoding/base64"
|
||||
|
||||
"github.com/xtls/xray-core/common/errors"
|
||||
)
|
||||
|
||||
func ApplyECH(c *Config, config *tls.Config) error {
|
||||
ECHConfig, err := base64.StdEncoding.DecodeString(c.EchConfig)
|
||||
if err != nil {
|
||||
errors.LogError(context.Background(), "invalid ECH config")
|
||||
}
|
||||
config.EncryptedClientHelloConfigList = ECHConfig
|
||||
return nil
|
||||
}
|
14
transport/internet/tls/ech_go121.go
Normal file
14
transport/internet/tls/ech_go121.go
Normal file
|
@ -0,0 +1,14 @@
|
|||
//go:build !go1.23
|
||||
// +build !go1.23
|
||||
|
||||
package tls
|
||||
|
||||
import (
|
||||
"crypto/tls"
|
||||
|
||||
"github.com/xtls/xray-core/common/errors"
|
||||
)
|
||||
|
||||
func ApplyECH(c *Config, config *tls.Config) error {
|
||||
return errors.New("Win7 does not support ECH")
|
||||
}
|
Loading…
Reference in a new issue