GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • phpboyscout/go/grpcclient
  • Home
  • Tutorials
  • How-to guides
  • Reference
  • Explanation
  • Godoc (pkg.go.dev)
  • Confirm a connection is actually encrypted
  • Dial options
  • Errors
  • What grpcclient does not do

This view

  • Original page
  • New address

GeezerVison is showing grpcclient.go.phpboyscout.uk — Home - grpcclient

grpcclient¶

A light, framework-free gRPC client dial factory. It builds a *grpc.ClientConn from a plain Target (host, port and go/tls material), and passes the go/transit client interceptors straight through as dial options.

go get gitlab.com/phpboyscout/go/grpcclient

gitlab.com/phpboyscout/go/grpcclient gives a service or library a gRPC client with project-standard TLS defaults and no framework in tow. Dial(Target{…}) returns a stock *grpc.ClientConn: transport credentials are selected from the target's go/tls pair (insecure when disabled, hardened TLS when enabled), the endpoint is assembled from host and port, and the caller's dial options are applied. It is the gRPC client half of the transport stack extracted from go-tool-base.

What it does¶

  • Framework-free. The module requires only the gRPC SDK, go/tls and go/errors. A depfootprint_test.go guard forbids go-tool-base, the server stack, and the cloud, CLI and TUI stacks, so a client-only consumer never inherits any of them.
  • Decoupled Target. The dial factory takes a first-class Target{Host, Port, TLS}, not a server-settings type, so a client never imports server configuration.
  • The interceptors are transit's. Circuit breaking and OpenTelemetry instrumentation are the go/transit gRPC client interceptors; you pass them to Dial as ordinary grpc.DialOptions. Transit is not a dependency of this module; add it to your own go.mod when you want it.

What it does not do¶

Dial will not do mutual TLS, will not validate a Target, will not retry, will not pool connections, and will not stop a caller's dial option from replacing the credentials it derived. Those are deliberate boundaries or known sharp edges rather than gaps waiting to be filled. What grpcclient does not do states each one and what to use instead.

Where next¶

  • Dial your first gRPC service: from go get to a working call, over plaintext and then TLS.
  • Dial a service with middleware: wire circuit breaking and OTel via transit interceptors.
  • Confirm a connection is actually encrypted: prove which credentials the transport used.
  • API reference: every Target field, its default, and what happens when it is wrong.
  • Errors returned by Dial: which failures Dial catches and which wait for the first RPC.
  • What grpcclient does not do: mutual TLS, validation, retries and the rest, with what to use instead.
  • The Target model and the factory split: how Dial selects credentials, and why the factory is separate from the middleware.
  • Godoc: generated API documentation on pkg.go.dev.

Part of the phpboyscout Go toolkit: small, framework-free Go modules extracted from go-tool-base.

Further reading¶

The blog carries a curated route through this subject: Building a web service in Go collects everything written about it, ordered so you can start at the beginning rather than newest-first.

Ask phpbotscout

phpbotscout

He answers questions about the projects over on the Discord, citing the docs where they already cover it, and offering to raise an issue where they don't. Bring a bug, an idea, or a questionable engineering decision.

Join the Discord

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.