mirror of
https://github.com/XTLS/Xray-core.git
synced 2025-07-27 12:24:14 +00:00
TLS client & server: Support Encrypted Client Hello (ECH) (#3813)
b9a72a4a26
---------
Co-authored-by: yuhan6665 <1588741+yuhan6665@users.noreply.github.com>
This commit is contained in:
parent
3fe02a658a
commit
fb7a9d8d61
10 changed files with 520 additions and 45 deletions
|
@ -412,6 +412,8 @@ type TLSConfig struct {
|
|||
MasterKeyLog string `json:"masterKeyLog"`
|
||||
ServerNameToVerify string `json:"serverNameToVerify"`
|
||||
VerifyPeerCertInNames []string `json:"verifyPeerCertInNames"`
|
||||
ECHConfigList string `json:"echConfigList"`
|
||||
ECHServerKeys string `json:"echServerKeys"`
|
||||
}
|
||||
|
||||
// Build implements Buildable.
|
||||
|
@ -483,6 +485,16 @@ func (c *TLSConfig) Build() (proto.Message, error) {
|
|||
}
|
||||
config.VerifyPeerCertInNames = c.VerifyPeerCertInNames
|
||||
|
||||
config.EchConfigList = c.ECHConfigList
|
||||
|
||||
if c.ECHServerKeys != "" {
|
||||
EchPrivateKey, err := base64.StdEncoding.DecodeString(c.ECHServerKeys)
|
||||
if err != nil {
|
||||
return nil, errors.New("invalid ECH Config", c.ECHServerKeys)
|
||||
}
|
||||
config.EchServerKeys = EchPrivateKey
|
||||
}
|
||||
|
||||
return config, nil
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue