make it possible to use multiple qtls versions at the same time, add support for Go 1.15 #2720
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #2614. Obviously, I need to cut a release of qtls-go115 (and rename the repository, since I accidentally pushed old tags there, and probably polluted the Go module cache with those...) before we can merge this PR. Other than that, this PR should be done.
Due to the super-tight coupling between qtls and tls we need to be able to use multiple versions of qtls, depending on the Go version we're using. This is necessary because we need to do what would be called a reinterpret-cast between structs defined in
qtls
and incrypto/tls
, e.g.This is obviously unsafe, but should be fine as long as the struct defined in
qtls
exactly matches the struct defined incrypto/tls
.When Go updates the struct in
crypto/tls
(as has happened on multiple occasions both for the Go 1.14 and Go 1.15 release), this violates this assumption. We'd need to include multiple versions ofqtls
. Unfortunately, Go Modules doesn't allow us to do this. We have to decide for one version.The workaround around this restriction is as straightforward as it is ugly: use separate repositories for the qtls code for Go 1.14 and Go 1.15. Then all we need is a thin shim layer around qtls, which imports the respective version for Go 1.14 and Go 1.15.
qtls-go115 goes a few steps further than the Go 1.14 version, in that it defines even more type aliases, especially for the
tls.Config
. This means that as atls.Config
is now essentially astls.Config
. This allows us to get rid of a lot of conversion code.