Documentation
¶
Overview ¶
Package replicationhttp transports a verified bootstrap 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 = errors.New("meldbase replication bootstrap: invalid response") ErrBootstrapHTTPSRequired = errors.New("meldbase replication bootstrap: HTTPS is required") )
Functions ¶
This section is empty.
Types ¶
type Authorize ¶
type Authorize = replicationauth.Authorize
Authorize authenticates an HTTPS request and returns a stable, server-controlled 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 returns the strict verified-leaf-fingerprint authorizer used by the WebSocket adapter too. 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 is the verified artifact receipt and the durable-feed bridge tokens that must be supplied to replicationws.ReceiverConfig.
func Fetch ¶
func Fetch(ctx context.Context, config FetchConfig) (Bootstrap, error)
Fetch downloads one bootstrap over a non-redirected HTTPS connection and imports it atomically. 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 configures a receiving bootstrap. HTTPClient must be configured with the deployment's mTLS client certificate and trusted server roots.
type MTLSConfig ¶
type MTLSConfig = replicationauth.MTLSConfig
MTLSConfig is shared with the WebSocket replication adapter, so bootstrap and tail transport cannot accidentally use different peer-name mappings.
type Source ¶
type Source struct {
// contains filtered or unexported fields
}
Source serves one exact, verified artifact and establishes the source durable checkpoint before it is made available to the receiver.
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 accepts only an authenticated 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.