Documentation
¶
Overview ¶
Package leasehttp provides authenticated HTTPS access to one controller member's lease records.
It uses strict JSON and mTLS. Certificate signing, Authority.Grant, and leader election remain outside the handler.
Index ¶
- Variables
- type Authorize
- type Client
- func (client *Client) CompareAndSwapPrimaryLease(ctx context.Context, databaseID [16]byte, previous *primarylease.LeaseRecord, ...) (bool, error)
- func (client *Client) LoadPrimaryLease(ctx context.Context, databaseID [16]byte) (primarylease.LeaseRecord, bool, error)
- func (client *Client) PrimaryLeaseMemberIdentities() []string
- func (client *Client) PrimaryLeaseMemberIdentity() string
- type ClientOptions
- type MTLSConfig
- type Member
- type MemberConfig
Constants ¶
This section is empty.
Variables ¶
var ( // ErrHTTPSRequired reports invalid HTTPS configuration or an untrusted server connection. ErrHTTPSRequired = errors.New("meldbase lease HTTP: verified HTTPS is required") // ErrProtocol reports invalid lease protocol data or responses. ErrProtocol = errors.New("meldbase lease HTTP: invalid protocol response") )
Functions ¶
This section is empty.
Types ¶
type Authorize ¶
type Authorize = replicationauth.Authorize
Authorize maps a verified peer certificate to a trusted controller identity.
The identity must not come from a lease frame or URL.
func NewMTLSAuthorizer ¶
func NewMTLSAuthorizer(config MTLSConfig) (Authorize, error)
NewMTLSAuthorizer creates an authorizer for verified and configured client certificates.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client reads and conditionally updates one controller member's lease records over verified HTTPS.
It implements primarylease.LeaseStore. QuorumStore handles majority decisions across several clients.
func NewClient ¶
func NewClient(options ClientOptions) (*Client, error)
NewClient creates a client with validated server pins and HTTP redirects disabled.
func (*Client) CompareAndSwapPrimaryLease ¶
func (client *Client) CompareAndSwapPrimaryLease(ctx context.Context, databaseID [16]byte, previous *primarylease.LeaseRecord, next primarylease.LeaseRecord) (bool, error)
CompareAndSwapPrimaryLease asks a member to replace a lease matching the expected state.
func (*Client) LoadPrimaryLease ¶
func (client *Client) LoadPrimaryLease(ctx context.Context, databaseID [16]byte) (primarylease.LeaseRecord, bool, error)
LoadPrimaryLease fetches and validates a member's lease record.
func (*Client) PrimaryLeaseMemberIdentities ¶
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 ¶
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 sets one controller member's endpoint, expected certificates, and HTTP client.
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
MTLSConfig maps verified peer certificate fingerprints to trusted identities.
type Member ¶
type Member struct {
// contains filtered or unexported fields
}
Member serves authenticated lease record reads and conditional writes over HTTP.
func NewMember ¶
func NewMember(config MemberConfig) (*Member, error)
NewMember creates a lease member handler with a store and peer authorizer.
type MemberConfig ¶
type MemberConfig struct {
Store primarylease.LeaseStore
Authorize Authorize
}
MemberConfig sets one controller member's lease store and peer authorization rules.
The enclosing server must require and verify client certificates; Authorize maps the verified leaf certificate to a configured controller identity.