Documentation
¶
Overview ¶
Package gateway is the control-plane gateway (FR-CORE-040): one listener serving every API over HTTP/1.1 REST and gRPC (h2c), routing by path prefix and Host, authenticating callers and recording the request log.
Index ¶
- Constants
- func NewServer(h http.Handler, log *slog.Logger) *http.Server
- type Gateway
- func (g *Gateway) GRPCOptions(service string) []grpc.ServerOption
- func (g *Gateway) HandleAdmin(h http.Handler)
- func (g *Gateway) Hosts() []string
- func (g *Gateway) Middleware(service string, h http.Handler) http.Handler
- func (g *Gateway) Register(s emu.Service) error
- func (g *Gateway) Router(service string) emu.Router
- func (g *Gateway) Serve(l net.Listener) error
- func (g *Gateway) ServeHTTP(w http.ResponseWriter, r *http.Request)
- func (g *Gateway) Shutdown(ctx context.Context) error
Constants ¶
const PathHost = "www.googleapis.com"
PathHost is Google's legacy shared API host. Its URLs carry the API in the path (www.googleapis.com/storage/v1/..., /oauth2/v3/certs, the compute selfLink base), which is exactly the gateway's path routing, so it is always served without a host mount.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Gateway ¶
type Gateway struct {
// Faults holds fault-injection rules applied to every request (FR-CORE-060).
Faults fault.Set
// contains filtered or unexported fields
}
Gateway multiplexes REST and gRPC for all services.
func (*Gateway) GRPCOptions ¶
func (g *Gateway) GRPCOptions(service string) []grpc.ServerOption
GRPCOptions returns interceptors that authenticate and log gRPC calls; service names the owner for per-service servers ("" = look up by method).
func (*Gateway) HandleAdmin ¶
HandleAdmin mounts the admin API (unauthenticated, not request-logged).
func (*Gateway) Hosts ¶
Hosts returns the sorted real hostnames mounted with host routing (e.g. "storage.googleapis.com") plus PathHost; the Google frontend (FR-CORE-043, FR-INT-007) serves exactly these names.
func (*Gateway) Middleware ¶
Middleware authenticates, recovers from panics and logs each HTTP request.