Documentation
¶
Overview ¶
Package replicationhttp transfers verified database snapshots over HTTPS.
It is intentionally only the bootstrap half of replication. After an import, callers attach the returned tokens to the WebSocket change-feed receiver. The authenticated durable-consumer name is server controlled; clients never select it in an HTTP header or URL.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrInvalidBootstrapResponse reports missing or inconsistent snapshot response metadata. ErrInvalidBootstrapResponse = errors.New("meldbase replication bootstrap: invalid response") // ErrBootstrapHTTPSRequired reports a URL or response that fails the verified HTTPS requirement. ErrBootstrapHTTPSRequired = errors.New("meldbase replication bootstrap: HTTPS is required") )
Functions ¶
This section is empty.
Types ¶
type Authorize ¶
type Authorize = replicationauth.Authorize
Authorize verifies a replication peer and returns its server-assigned durable consumer name.
Typical deployments map a verified mTLS client certificate fingerprint to that name. It must not derive the name from a user-controlled request value.
func NewMTLSAuthorizer ¶
func NewMTLSAuthorizer(config MTLSConfig) (Authorize, error)
NewMTLSAuthorizer creates a peer authorizer using verified client certificate fingerprints.
The WebSocket adapter uses the same authorizer. The enclosing http.Server must still require and verify client certificates in its tls.Config.
type Bootstrap ¶
type Bootstrap struct {
Backup meldbase.BackupResult
CheckpointToken uint64
SnapshotToken uint64
}
Bootstrap records the verified snapshot and the positions needed to resume replication.
Supply its feed tokens to replicationws.ReceiverConfig.
func Fetch ¶
func Fetch(ctx context.Context, config FetchConfig) (Bootstrap, error)
Fetch downloads, verifies, and atomically imports a database snapshot over HTTPS.
Redirects are disabled. It requires an actual TLS response even when callers provide a custom HTTP transport, preventing a transport shim from silently downgrading the security contract.
type FetchConfig ¶
FetchConfig sets the snapshot source, destination file, HTTP client, and download limit.
HTTPClient must use the deployment's mTLS client certificate and trusted server roots.
type MTLSConfig ¶
type MTLSConfig = replicationauth.MTLSConfig
MTLSConfig sets the verified certificate mappings shared by snapshot and WebSocket replication.
type Source ¶
type Source struct {
// contains filtered or unexported fields
}
Source serves a verified snapshot after establishing its durable consumer checkpoint.
func NewSource ¶
func NewSource(config SourceConfig) (*Source, error)
NewSource validates configuration and returns an HTTP handler source.
func (*Source) ServeHTTP ¶
func (source *Source) ServeHTTP(writer http.ResponseWriter, request *http.Request)
ServeHTTP sends a verified database snapshot to an authenticated replication peer.
It accepts only a GET with no browser Origin. The source lease covers both bootstrap and a subsequent replicationws source session, preventing two transports from racing one durable checkpoint.
type SourceConfig ¶
SourceConfig sets the database, peer authorization, and temporary snapshot storage for an HTTPS handler.
TLS and client-certificate verification belong to the enclosing http.Server; Authorize enforces its application-level identity mapping.