New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Construct a utls.Config
from a tls.Config
#17
Comments
If you believe that it is generally useful , I wouldn't object to a PR that generates |
It's not as easy as it seems at first, because
For me, a perfect 1:1 clone isn't necessary. I can just try not to use the fields that have problems. I worked out a demo using a reflection trick that copies public fields that have a compatible type. Click to expand program
The output of this program shows which fields are copied and which are not. This is with go1.10.5:
It works for the fields that are important to me, which are Are there any negative side effects of setting fields in a |
Yes, some (but not all) of them will be overwritten. If desired field will be overwritten, you can force uTLS to fill the config first by calling @AxbB36 would it be correct to say that you would have no need to construct utls.Config out of tls.Config, if #16 (comment) is implemented? |
I don't really have a need for this anymore. In the http2 |
At #16 (comment) I had to adapt utls to the interface of
http2.Transport
. TheDialTLS
callback receives a golang net/cryptotls.Config
. To create aUClient
I need autls.Config
. I can't just pass on thetls.Config
, because the two types are incompatible.I manually created a new
utls.Config
and copied theNextProtos
member because it was important for my example, but in general there are other important fields that may need to be copied.Mainline crypto/tls provides a
Config.Clone
method that internally knows which fields are safe to copy (not all are safe to copy, for example locks). Does it make sense to have something similar to create autls.Config
from an existingtls.Config
?The text was updated successfully, but these errors were encountered: