Skip to content

Commit

Permalink
Fix the use of ServerName in ECH config
Browse files Browse the repository at this point in the history
  • Loading branch information
dyhkwong committed Oct 12, 2024
1 parent 6a242d1 commit a5db83a
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 a5db83a

Please sign in to comment.