Skip to content

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.

go get gitlab.com/phpboyscout/go/grpcclient

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. A depfootprint_test.go guard 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/transit gRPC client interceptors; you pass them to Dial as ordinary grpc.DialOptions.

Where next


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