grpcclient¶
A light, framework-free gRPC client dial factory — build a *grpc.ClientConn
from a plain Target (host, port and go/tls material), with the go/transit client
interceptors passed straight through as dial options.
gitlab.com/phpboyscout/go/grpcclient gives a service or library a secure gRPC client
without a framework in tow. Dial(Target{…}) returns a stock *grpc.ClientConn:
transport credentials are selected from the target's go/tls
pair (insecure loopback when disabled, hardened TLS when enabled), the endpoint is
assembled from host and port, and the caller's dial options — into which the
go/transit client interceptors are passed — are
applied. It is the gRPC client half of the transport stack extracted from
go-tool-base.
Why¶
- Framework-free. It depends only on the gRPC SDK,
go/tls, go/transit
and
cockroachdb/errors. Adepfootprint_test.goguard forbids go-tool-base, the server stack (controls/authn/gateway), and the cloud/CLI/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, OpenTelemetry instrumentation
and request logging are the
go/transitgRPC client interceptors; you pass them toDialas ordinarygrpc.DialOptions.
Where next¶
- Getting started — dial a service and make a call in a few lines.
- Dial a service with middleware — wire circuit breaking, OTel and logging via transit interceptors.
- The Target model & credentials
— how
Dialselects credentials, and why the factory is separate from the middleware. - API reference — full godoc on pkg.go.dev.
Part of the phpboyscout Go toolkit — small, framework-free Go modules extracted from go-tool-base.