Skip to content

Commit 13bad86

Browse files
authored
Fix the use of ServerName in ECH config (#3188)
1 parent 9ae5e71 commit 13bad86

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

transport/internet/tls/ech.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,11 @@ func ApplyECH(c *Config, config *tls.Config) error {
2424
if len(c.EchConfig) > 0 {
2525
ECHConfig = c.EchConfig
2626
} else { // ECH config > DOH lookup
27-
if config.ServerName == "" {
28-
return newError("Using DOH for ECH needs serverName")
27+
addr := net.ParseAddress(config.ServerName)
28+
if !addr.Family().IsDomain() {
29+
return newError("Using DOH for ECH needs SNI")
2930
}
30-
ECHConfig, err = QueryRecord(c.ServerName, c.Ech_DOHserver)
31+
ECHConfig, err = QueryRecord(addr.Domain(), c.Ech_DOHserver)
3132
if err != nil {
3233
return err
3334
}

0 commit comments

Comments
 (0)