mirror of
https://github.com/XTLS/Xray-core.git
synced 2024-11-15 01:09:20 +02: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
|
||||
|
|
|
@ -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
|
||||
}
|
|
@ -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 New Issue