Comments (5)
You can specify the passthrough resolver by using "passthrough:///bufnet"
as your target instead (and actually buffnet
is arbitrary; you could put anything there instead, or probably omit it entirely).
Or you can globally make the default resolver "passthrough" by using https://pkg.go.dev/google.golang.org/grpc/resolver#SetDefaultScheme -- I do not recommend this approach, though, as "passthrough" has some negative properties and really only exists for backward compatibility reasons.
You can also feel free to keep using Dial
; it is not going anywhere. We don't recommend its use, but we will continue to support it for all 1.x releases (and no 2.x release is being considered).
Ideally we will eventually add support for an "in-memory" transport for your exact use case. However, that does not currently exist. That would probably require something like #906 which we just don't have the resources to prioritize.
from grpc-go.
Default resolver is now dns with NewClient, was passthrough
I suppose you'll have to force passthrough resolver
With WithResolvers ?
from grpc-go.
From DialContext 1.63.0 doc :
One subtle difference between NewClient and Dial and DialContext is that the former uses "dns" as the default name resolver, while the latter use "passthrough" for backward compatibility. This distinction should not matter to most users, but could matter to legacy users that specify a custom dialer and expect it to receive the target string directly.
from grpc-go.
Thanks for the feedback @SLoeuillet!
I've gave a check to WithResolvers()
(which is experimental). It expects a resolver.Builder.
Ideally, I'd pass a passthrough's Builder in order to get the original behavior.
But the passthrough package is only available behind an internal/
directory, so I can't import it:
grpc-go/resolver/passthrough/passthrough.go
Lines 24 to 26 in c68f456
Initially, I also checked if I could set the defaultScheme to passthrough
(that's what grpc.DialContext
does now).
But the field and the setter are are not exported either.
Lines 662 to 668 in c68f456
The only workaround I think of would be to copy the passthrough implementation, so I can pass it to WithResolvers()
but that seems counter-intuitive.
As of now, in order to upgrade grpc-go to v1.63.0
, I think the best way is to keep using the deprecated grpc.DialContext()
function.
Is it intended by the grpc-go developer team? Is there an alternative?
Thanks!
from grpc-go.
Oh awesome! It works like a charm!
Thanks a lot!
from grpc-go.
Related Issues (20)
- GitHub Action: branch protection checks are skipped, and also not blocking merges HOT 3
- grpc.NewClient with namedpipe on Windows throws resolverError HOT 2
- User agent becomes grpc-go/1.64. on server side of grpc gateway HOT 3
- xds: move functionality from `xds/internal` to `internal/xds`
- stubserver: add support to optionally pass in a `grpc.Server` or `xds.GRPCServer` HOT 2
- Github Action: Codecov action is broken and is failing silently HOT 1
- Upgrade to using math/rand/v2 to get perf enhancements HOT 2
- xds: tests shouldn't rely on the presence of an entry in the `authorities` field of the bootstrap configuration with an empty key
- Experimental API related to metadata HOT 4
- Linter rule for using context.Background() without a timeout in tests HOT 4
- gRPC is incompatible with tls.Listener HOT 2
- Closing connection takes up to 15 minutes. HOT 5
- Feature Request: expose handleRawConn or add ServeConn HOT 21
- Flaky test: TimerAndWatchStateOnErrorCallback HOT 1
- xds: bootstrap config is not emitted to logs in a human readable way
- Strongly-type request inside a Stream Server Interceptor HOT 2
- Proxy connection buffer necessary?
- Why does grpc.NewClient silently ignore DialOptions? HOT 2
- Make transport.SetConnection public? HOT 4
- what's the default max data size
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from grpc-go.