fix: do not change outer sni back to real sni

This commit is contained in:
Mingye Chen 2025-03-27 16:33:53 -06:00
parent bea2f33a11
commit fa20ecfcc0

View file

@ -587,14 +587,12 @@ func (uconn *UConn) MarshalClientHello() error {
return fmt.Errorf("sni extension missing while attempting ECH") return fmt.Errorf("sni extension missing while attempting ECH")
} }
oldSNI := uconn.Extensions[sniExtIdex]
uconn.Extensions[sniExtIdex] = &SNIExtension{ uconn.Extensions[sniExtIdex] = &SNIExtension{
ServerName: string(ech.config.PublicName), ServerName: string(ech.config.PublicName),
} }
uconn.computeAndUpdateOuterECHExtension(inner, ech, true) uconn.computeAndUpdateOuterECHExtension(inner, ech, true)
uconn.Extensions[sniExtIdex] = oldSNI
uconn.echCtx = ech uconn.echCtx = ech
return nil return nil
} }