1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-12-22 01:57:12 -05:00

Fix the use of ServerName in ECH config (#3188)

This commit is contained in:
dyhkwong 2024-10-13 02:59:43 +08:00 committed by GitHub
parent 9ae5e71711
commit 13bad86c3b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -24,10 +24,11 @@ func ApplyECH(c *Config, config *tls.Config) error {
if len(c.EchConfig) > 0 {
ECHConfig = c.EchConfig
} else { // ECH config > DOH lookup
if config.ServerName == "" {
return newError("Using DOH for ECH needs serverName")
addr := net.ParseAddress(config.ServerName)
if !addr.Family().IsDomain() {
return newError("Using DOH for ECH needs SNI")
}
ECHConfig, err = QueryRecord(c.ServerName, c.Ech_DOHserver)
ECHConfig, err = QueryRecord(addr.Domain(), c.Ech_DOHserver)
if err != nil {
return err
}