feat: make pub Channel
fns that allow creating it from a custom connector
#2015
+10
−5
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.
The connector is required to be a
Service
that accepts ahttp::Uri
and returns a connection implementing hyper's IO traits, which is a very reasonable requirement that can be fulfilled by advanced users that need to customize any mechanics that don't fit into the paved path for HTTP and HTTPS with tonic.One such requirement is customizing
rustls::ClientConfig
, which has come up for a number of users. They have been pointed in the direction of a custom connector, but the APIs onEndpoint
are not always suitable:Endpoint::connect_(lazy_)with_connector
always wraps the provided connector withtransport::channel::service::Connector
. This wrapper raises an errorHttpsUriWithoutTlsSupport
if (the scheme ishttps://
+ thetls
feature is enabled + andEndpoint::tls_config()
was not used) ref. This is a good safety feature in general, but not if the wrapped connector is taking care of TLS.As a side bonus,
transport::channel::service::io::BoxedIo
can be avoided.