Skip to content

transport

A framework-free HTTP, gRPC and gateway server stack for Go: hardened server constructors, health/liveness/readiness endpoints, request and RPC authentication, and security headers, built on go/controls, go/authn, go/transit and go/tls.

go get gitlab.com/phpboyscout/go/transport

gitlab.com/phpboyscout/go/transport is the server half of the transport stack extracted from go-tool-base. It gives a service an HTTP server, a gRPC server or both, with health probes, TLS, authentication and security headers wired in and lifecycle handled by go/controls, without a CLI framework in tow. Three sub-packages, composed as you need them:

  • transport/http: the hardened *http.Server: HealthHandler / LivenessHandler / ReadinessHandler, NewServer from typed ServerSettings, AuthMiddleware, SecurityHeadersMiddleware, and StartWithTLSPair/Stop/Status glue for go/controls.
  • transport/grpc: the hardened *grpc.Server: NewServer, RegisterHealthService, AuthInterceptor, TLS server/client credentials, DialLocal, and the same lifecycle glue.
  • transport/gateway: a grpc-gateway exposing a gRPC service over REST/JSON.

Why

  • Framework-free. It depends on go/controls (lifecycle), go/authn, go/transit (middleware), go/tls, go/grpcclient, go/redact, go/errors, the gRPC SDK and the grpc-gateway runtime, but not on go-tool-base or the CLI/config/TUI stack. A depfootprint test enforces that boundary.
  • Secure by default. Hardened TLS, bounded timeouts, health endpoints mounted outside the auth chain on the Register path, security headers and credential-redacting auth.
  • The middleware is transit's. Request logging, OpenTelemetry, circuit breaking and rate limiting are the go/transit server middleware; this stack composes them.

Where next


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