leasehttp

package
v0.1.0-alpha.13 Latest Latest
Warning

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

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

Documentation

Overview

Package leasehttp exposes one authenticated primarylease.LeaseStore member over strict HTTPS/mTLS JSON. It is a member adapter, not a leader-election API: certificate signing and Authority.Grant remain outside the handler.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrHTTPSRequired = errors.New("meldbase lease HTTP: verified HTTPS is required")
	ErrProtocol      = errors.New("meldbase lease HTTP: invalid protocol response")
)

Functions

This section is empty.

Types

type Authorize

type Authorize = replicationauth.Authorize

Authorize authenticates a verified mTLS peer. Its returned stable identity is deliberately not supplied by a lease frame or URL.

func NewMTLSAuthorizer

func NewMTLSAuthorizer(config MTLSConfig) (Authorize, error)

type Client

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

Client implements primarylease.LeaseStore over a single verified HTTPS member endpoint. QuorumStore owns majority behavior across several clients.

func NewClient

func NewClient(options ClientOptions) (*Client, error)

func (*Client) CompareAndSwapPrimaryLease

func (client *Client) CompareAndSwapPrimaryLease(ctx context.Context, databaseID [16]byte, previous *primarylease.LeaseRecord, next primarylease.LeaseRecord) (bool, error)

func (*Client) LoadPrimaryLease

func (client *Client) LoadPrimaryLease(ctx context.Context, databaseID [16]byte) (primarylease.LeaseRecord, bool, error)

func (*Client) PrimaryLeaseMemberIdentities

func (client *Client) PrimaryLeaseMemberIdentities() []string

PrimaryLeaseMemberIdentities exposes every expected, verified server leaf fingerprint to primarylease.QuorumStore. The returned copy is canonical and cannot mutate the client's identity configuration.

func (*Client) PrimaryLeaseMemberIdentity

func (client *Client) PrimaryLeaseMemberIdentity() string

PrimaryLeaseMemberIdentity retains the legacy single-identity method. New callers must use PrimaryLeaseMemberIdentities so certificate rotation cannot hide an overlapping member identity.

type ClientOptions

type ClientOptions struct {
	Endpoint string
	// ExpectedServerFingerprint is the legacy single-leaf configuration. New
	// deployments should use ExpectedServerFingerprints so an old and a new
	// leaf can overlap during a controlled rotation. The two fields are mutually
	// exclusive.
	ExpectedServerFingerprint string
	// ExpectedServerFingerprints is one to four lowercase SHA-256 server leaf
	// fingerprints. Every configured leaf identifies the same static quorum
	// member; QuorumStore rejects an overlap with another replica's pin set.
	ExpectedServerFingerprints []string
	HTTPClient                 *http.Client
}

ClientOptions creates one HTTPS LeaseStore client for a configured quorum member. HTTPClient should carry the caller's mTLS certificate and trusted server roots. The endpoint cannot include a path, query, userinfo or fragment, preventing URL-controlled routing ambiguity.

type MTLSConfig

type MTLSConfig = replicationauth.MTLSConfig

type Member

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

Member is an HTTP handler for exact Load/CAS LeaseStore operations.

func NewMember

func NewMember(config MemberConfig) (*Member, error)

func (*Member) ServeHTTP

func (member *Member) ServeHTTP(writer http.ResponseWriter, request *http.Request)

type MemberConfig

type MemberConfig struct {
	Store     primarylease.LeaseStore
	Authorize Authorize
}

MemberConfig configures one controller member handler. The enclosing server must require and verify client certificates; Authorize maps the verified leaf certificate to a configured controller identity.

Jump to

Keyboard shortcuts

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