Open xdown-dev opened 1 month ago
Related Issues and Documentation
(Emoji vote if this was helpful or unhelpful; more detailed feedback welcome in this discussion.)
I don't think your example is a good demonstration of your point.
In your example you manually set the ECH configuration values, then crypto/tls
returns (wrapped) crypto/tls.ECHRejectionError
, you can use errors.As
to grab the server's retry list. Given you manually configured ECH I think it make sense you also manually configure retry.
I think your point would be strong if you can show an example where your code "just" do a plain HTTP query, and go setups ECH Client for you under the hood and that still fails.
Also I changed the code:
if err != nil {
+ var tgt *tls.ECHRejectionError
+ if !errors.As(err, &tgt) { panic("wrong error type") }
+ log.Fatalf("请求失败: %v", tgt.RetryConfigList)
- log.Fatalf("请求失败: %v", err)
}
And it shows an empty RetryConfigList
:
2024/10/28 15:23:44 请求失败: []
exit status 1
I've also tried looking at the connection through wireshark and I do not find anything of that sort (I could have missed it). So I'm not even sure go could even retry anything as it looks like the server is not sending any other key.
resp, err := client.Get("https://tls-ech.dev/")
2024/10/29 14:20:58 请求失败: Get "https://tls-ech.dev/": tls: failed to verify certificate: x509: certificate is valid for public.tls-ech.dev, stale.tls-ech.dev, tls-ech.dev, tls12.tls-ech.dev, wrong.tls-ech.dev, not cloudflare-ech.com
What if we test it with https://tls-ech.dev/? Is it because the cloudflare ech server did not return the result?
What ECH Key should I be using for tls-ech.dev
?
Go version
go1.23.2 linux/amd64
Output of
go env
in your module/workspace:What did you do?
What did you see happen?
2024/10/28 10:05:19 请求失败: Get "https://ok-ssl.xyz/cdn-cgi/trace": tls: server rejected ECH
What did you expect to see?
If I use an expired key for handshake, an error will be returned. This should not be the case. The key is obtained through DNS, but DNS may have cache errors. At this time, the new key returned by ECH should be used to re-handshake. I don't know if this understanding is correct?