Documentation
¶
Overview ¶
Package grpcclient is a light, framework-free gRPC client dial factory.
It builds a *grpc.ClientConn from a plain Target (host, port and go/tls material), selecting transport credentials from the target's TLS pair and applying the caller's dial options — into which gitlab.com/phpboyscout/go/transit's client interceptors (OTelClientHandler, CircuitBreakerInterceptor, …) are passed. It depends only on the gRPC SDK, go/tls and go/transit; it never pulls in the server stack (controls, authn, gateway) or the CLI/config/TUI stack, so a client-only consumer stays light. A depfootprint test enforces that boundary.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Dial ¶
func Dial(t Target, opts ...grpc.DialOption) (*grpc.ClientConn, error)
Dial creates a gRPC client connection to the target. It builds transport credentials from t.TLS (insecure when disabled), assembles the endpoint from Host/Port (empty Host means loopback), and applies the caller's dial options. Pass go/transit client interceptors — OTelClientHandler, the circuit-breaker client interceptors — as dial options here.
It uses grpc.NewClient, so the returned connection is lazy: no network I/O happens until the first RPC.
Types ¶
type Target ¶
type Target struct {
// Host is the dial host. Empty means loopback (localhost), the common case
// for dialing a co-located local server.
Host string
// Port is the dial port.
Port int
// TLS is the go/tls transport pair. When disabled, insecure loopback
// credentials are used; when enabled, transport credentials are built via
// go/tls, trusting the CA in TLS.Cert (or the system roots when Cert is empty).
TLS gtls.Pair
}
Target identifies a gRPC server to dial. It is deliberately decoupled from any server-side settings type: a caller supplies just the host, port and TLS material, so a client-only consumer never imports a server configuration type.