gateway

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 10, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package gateway routes requests arriving on doze-aws's single shared endpoint to the right service, the way AWS SDKs of every generation address a custom endpoint. A request identifies its service by (tried in order):

  1. the X-Amz-Target header's prefix (all JSON-protocol services);
  2. the SigV4 credential scope's service name (header or presigned query) — SigV2 signatures carry no service name and fall through;
  3. a Lambda REST-API path prefix (/2015-03-31/..., etc.);
  4. the Query-protocol Action parameter, looked up in a static action table (distinguishes STS from SNS for unsigned/SigV2 requests);
  5. otherwise S3 — the host/path shapes S3 clients produce are too varied to enumerate, so S3 is the fallback, matching LocalStack ergonomics.

The gateway is routing only: it never interprets a request beyond picking a handler, and it restores any body bytes it had to peek at.

Index

Constants

This section is empty.

Variables

View Source
var Services = []string{
	"s3", "sqs", "sns", "sts", "dynamodb", "kms", "ssm", "secretsmanager", "eventbridge", "lambda",
}

Services is the canonical set of doze-aws service names, in the order they appear in docs and config listings.

Functions

func KnownService

func KnownService(name string) bool

KnownService reports whether name is one of the canonical service names.

Types

type Gateway

type Gateway struct {
	// contains filtered or unexported fields
}

Gateway is the shared-endpoint router. Register handlers for the services a deployment enables; requests for everything else get a clean error.

func New

func New(opts Options) *Gateway

New builds an empty gateway; add services with Register.

func (*Gateway) Handler

func (g *Gateway) Handler(service string) http.Handler

Handler returns the registered handler for a service, or nil.

func (*Gateway) Register

func (g *Gateway) Register(service string, h http.Handler)

Register mounts h as the handler for the named service.

func (*Gateway) ServeHTTP

func (g *Gateway) ServeHTTP(w http.ResponseWriter, r *http.Request)

type Options

type Options struct {
	// Logf receives one line per routing failure; nil discards.
	Logf func(format string, args ...any)
	// Now is the clock used for presigned-URL expiry; nil means time.Now.
	Now func() time.Time
}

Options configures a Gateway.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL