Skip to content

transport

A framework-free HTTP + gRPC + gateway server stack for Go — hardened server constructors, health/liveness/readiness endpoints, request/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 a secure, lifecycle-managed HTTP and/or gRPC server — with health probes, TLS, authentication and security headers wired in — 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 the transport essentials — go/controls (lifecycle), go/authn, go/transit (middleware), go/tls, the gRPC SDK and the grpc-gateway runtime — but not go-tool-base or the CLI/config/TUI stack. A depfootprint guard enforces that boundary.
  • Secure by default. Hardened TLS, bounded timeouts, health endpoints mounted outside the auth chain, security headers and credential-redacting auth ship ready to use.
  • 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