tonic
tonic copied to clipboard
Using tonic for clients still pulls in extra dependencies
From my comment in https://github.com/hyperium/tonic/issues/959#issuecomment-1108264503:
I finally tried using #960 and I don't think it's an adequate fix. First of all, the
tls
feature still pulls intransport
, so by default if you pull intls
or one of the features that depend on it, you'll still get the server-side dependencies. That part can actually be worked around by depending on the other required features directly, but then I noticed that the entiretonic::transport
module is unavailable if thetransport
feature is disabled, so I don't have access to things likeError
,Channel
orEndpoint
from that module.Should I submit a PR replacing the use of
transport
internally withchannel
for client-side or both-side items?
Ugh yeah seems like a mess, honestly, I would just use tonic without the transport module. Its still a bit of a mess but will allow you better fine grained control over what you pull in. Is this change for something internal or is it in a public repo?
Something internal, though it's probably also relevant for parts of opentelemetry-rust (notably, opentelemetry-stackdriver).
Do you think migrating to using hyper is feasible?
I wrote this PR that should make using hyper directly much easier https://github.com/hyperium/tonic/pull/1017
Is there any example code for using tonic without the transport stuff?
@djc the rustls examples under the tls folder has examples of using hyper. In general, it should just work, except servers don't provide the make service portion.