Skip to content

Commit

Permalink
Fix the use of ServerName in ECH config (#3188)
Browse files Browse the repository at this point in the history
  • Loading branch information
dyhkwong authored Oct 12, 2024
1 parent 9ae5e71 commit 13bad86
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions transport/internet/tls/ech.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit 13bad86

Please sign in to comment.