Help us shape the future of Go! Take the 2026 Go Developer Survey

transparent

package
v1.9.0 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package transparent serves gopherstack over HTTPS for unmodified AWS SDKs that target real *.amazonaws.com endpoints (DNS points them at gopherstack).

Index

Constants

View Source
const (
	// DefaultAddr is the HTTPS listen address real AWS endpoints expect.
	DefaultAddr = ":443"
	// CAPath serves the CA certificate clients must trust.
	CAPath = "/_gopherstack/ca.pem"
)

Variables

This section is empty.

Functions

func CAHandler

func CAHandler(ca *devtls.CA) http.Handler

CAHandler serves the CA certificate PEM.

func IsAWSHost

func IsAWSHost(host string) bool

IsAWSHost reports whether host (port optional) is a real AWS endpoint name.

func S3HostRouter

func S3HostRouter(next http.Handler) http.Handler

S3HostRouter maps S3 access-point, website and S3 Control hostnames onto the path-based routes next serves; other requests pass through untouched.

Types

type CertSource

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

CertSource issues leaf certificates on demand from SNI, signed by a CA.

func NewCertSource

func NewCertSource(ca *devtls.CA) *CertSource

NewCertSource creates a CertSource backed by ca.

func (*CertSource) Close

func (c *CertSource) Close()

Close releases the cache.

func (*CertSource) GetCertificate

func (c *CertSource) GetCertificate(hello *tls.ClientHelloInfo) (*tls.Certificate, error)

GetCertificate implements tls.Config.GetCertificate. A name's certificate also covers its siblings via a one-label wildcard on the parent zone.

type PlainServer

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

PlainServer is a running plain-HTTP listener (for http:// AWS endpoint URLs).

func StartHTTP

func StartHTTP(ctx context.Context, addr string, h http.Handler) (*PlainServer, error)

StartHTTP listens on addr and serves h over plain HTTP until ctx is done.

func (*PlainServer) Addr

func (s *PlainServer) Addr() net.Addr

Addr returns the bound listen address.

func (*PlainServer) Close

func (s *PlainServer) Close() error

Close gracefully shuts the listener down and waits for it to exit.

type S3Host

type S3Host struct {
	// Name is the access point name or website bucket.
	Name string
	// Account is the 12-digit account of an access-point or control host.
	Account string
	Kind    S3HostKind
}

S3Host is a parsed S3 endpoint hostname.

func ParseS3Host

func ParseS3Host(host string) (S3Host, bool)

ParseS3Host recognises access-point, website and S3 Control hostnames (dual-stack and FIPS included).

type S3HostKind

type S3HostKind int

S3HostKind classifies a real S3 endpoint hostname that is not plain path/virtual-hosted data access.

const (
	// S3HostAccessPoint is <name>-<account>.s3-accesspoint[-fips].<region>.<zone>.
	S3HostAccessPoint S3HostKind = iota + 1
	// S3HostWebsite is <bucket>.s3-website[-<region>|.<region>].<zone>.
	S3HostWebsite
	// S3HostControl is <account>.s3-control[-fips][.dualstack].<region>.<zone>.
	S3HostControl
)

type Server

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

Server is a running transparent HTTPS listener.

func Start

func Start(ctx context.Context, addr string, h http.Handler, ca *devtls.CA) (*Server, error)

Start listens on addr and serves h over TLS with on-demand AWS certificates until ctx is done.

func (*Server) Addr

func (s *Server) Addr() net.Addr

Addr returns the bound listen address.

func (*Server) Close

func (s *Server) Close() error

Close gracefully shuts the listener down and waits for it to exit.

Jump to

Keyboard shortcuts

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