mirror of
https://github.com/XTLS/Xray-core.git
synced 2025-05-14 05:04:12 +08:00
Update utls and little change
This commit is contained in:
parent
43d890bce2
commit
38ce793b7c
@ -27,14 +27,8 @@ func ApplyECH(c *Config, config *tls.Config) error {
|
|||||||
// for client
|
// for client
|
||||||
if len(c.EchConfigList) != 0 {
|
if len(c.EchConfigList) != 0 {
|
||||||
// direct base64 config
|
// direct base64 config
|
||||||
if strings.HasPrefix(c.EchConfigList, "base64") {
|
if strings.Contains(c.EchConfigList, "://") {
|
||||||
Base64ECHConfigList := c.EchConfigList[len("base64://"):]
|
// query config from dns
|
||||||
ECHConfigList, err := goech.ECHConfigListFromBase64(Base64ECHConfigList)
|
|
||||||
if err != nil {
|
|
||||||
return errors.New("Failed to unmarshal ECHConfigList: ", err)
|
|
||||||
}
|
|
||||||
ECHConfig, _ = ECHConfigList.MarshalBinary()
|
|
||||||
} else { // query config from dns
|
|
||||||
parts := strings.Split(c.EchConfigList, "+")
|
parts := strings.Split(c.EchConfigList, "+")
|
||||||
if len(parts) == 2 {
|
if len(parts) == 2 {
|
||||||
// parse ECH DNS server in format of "example.com+https://1.1.1.1/dns-query"
|
// parse ECH DNS server in format of "example.com+https://1.1.1.1/dns-query"
|
||||||
@ -53,6 +47,12 @@ func ApplyECH(c *Config, config *tls.Config) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
ECHConfigList, err := goech.ECHConfigListFromBase64(c.EchConfigList)
|
||||||
|
if err != nil {
|
||||||
|
return errors.New("Failed to unmarshal ECHConfigList: ", err)
|
||||||
|
}
|
||||||
|
ECHConfig, _ = ECHConfigList.MarshalBinary()
|
||||||
}
|
}
|
||||||
|
|
||||||
config.EncryptedClientHelloConfigList = ECHConfig
|
config.EncryptedClientHelloConfigList = ECHConfig
|
||||||
|
@ -134,6 +134,7 @@ func copyConfig(c *tls.Config) *utls.Config {
|
|||||||
InsecureSkipVerify: c.InsecureSkipVerify,
|
InsecureSkipVerify: c.InsecureSkipVerify,
|
||||||
VerifyPeerCertificate: c.VerifyPeerCertificate,
|
VerifyPeerCertificate: c.VerifyPeerCertificate,
|
||||||
KeyLogWriter: c.KeyLogWriter,
|
KeyLogWriter: c.KeyLogWriter,
|
||||||
|
EncryptedClientHelloConfigList: c.EncryptedClientHelloConfigList,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -179,7 +180,7 @@ func GetFingerprint(name string) (fingerprint *utls.ClientHelloID) {
|
|||||||
|
|
||||||
var PresetFingerprints = map[string]*utls.ClientHelloID{
|
var PresetFingerprints = map[string]*utls.ClientHelloID{
|
||||||
// Recommended preset options in GUI clients
|
// Recommended preset options in GUI clients
|
||||||
"chrome": &utls.HelloChrome_120,
|
"chrome": &utls.HelloChrome_131,
|
||||||
"firefox": &utls.HelloFirefox_Auto,
|
"firefox": &utls.HelloFirefox_Auto,
|
||||||
"safari": &utls.HelloSafari_Auto,
|
"safari": &utls.HelloSafari_Auto,
|
||||||
"ios": &utls.HelloIOS_Auto,
|
"ios": &utls.HelloIOS_Auto,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user