client

package
v0.0.76 Latest Latest
Warning

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

Go to latest
Published: May 17, 2026 License: AGPL-3.0, AGPL-3.0 Imports: 30 Imported by: 0

Documentation

Overview

Package client implements the Katzenpost voting authority client.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(cfg *Config) (pki.PostingClient, error)

New constructs a new pki.PostingClient instance. The voting authority client implements the full PKI surface (fetch, deserialize against configured dirauth verifiers, and both descriptor-upload methods). Callers that need only a narrower role may upcast the returned value on assignment to a pki.Fetcher, pki.Deserializer, pki.MixNodeClient, or pki.ReplicaNodeClient variable.

Types

type Client

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

Client is a PKI client.

func (*Client) Deserialize

func (c *Client) Deserialize(raw []byte) (*pki.Document, error)

Deserialize returns PKI document given the raw bytes.

func (*Client) GetPKIDocumentForEpoch added in v0.0.64

func (c *Client) GetPKIDocumentForEpoch(ctx context.Context, epoch uint64) (*pki.Document, []byte, error)

GetPKIDocumentForEpoch returns the PKI document for the provided epoch.

The configured authorities are contacted in parallel. The first peer to return a valid, threshold-signed, well-formed document for the requested epoch wins and the remaining in-flight fetches are cancelled. A single unreachable or slow authority cannot delay progress when at least one peer is responsive.

func (*Client) LastPostReplicaAcceptedAuthorities added in v0.0.75

func (c *Client) LastPostReplicaAcceptedAuthorities(epoch uint64) []string

LastPostReplicaAcceptedAuthorities returns the authorities that accepted the most recent PostReplica call for the requested epoch.

func (*Client) LastPostReplicaConflictAuthorities added in v0.0.75

func (c *Client) LastPostReplicaConflictAuthorities(epoch uint64) []string

LastPostReplicaConflictAuthorities returns the authorities that reported a descriptor conflict during the most recent PostReplica call for the requested epoch.

func (*Client) Post

func (c *Client) Post(
	ctx context.Context,
	epoch uint64,
	signingPrivateKey sign.PrivateKey,
	signingPublicKey sign.PublicKey,
	d *pki.MixDescriptor,
	loopstats *loops.LoopStats,
) error

Post posts the node's descriptor to the PKI for the provided epoch.

func (*Client) PostReplica added in v0.0.44

func (c *Client) PostReplica(
	ctx context.Context,
	epoch uint64,
	signingPrivateKey sign.PrivateKey,
	signingPublicKey sign.PublicKey,
	d *pki.ReplicaDescriptor,
) error

PostReplica posts the replica descriptor.

type Config

type Config struct {
	// KEMScheme indicates the KEM scheme used for the LinkKey/wire protocol.
	KEMScheme kem.Scheme

	// PKISignatureScheme specifies the cryptographic signature scheme.
	PKISignatureScheme sign.Scheme

	// LinkKey is the link key for the client's wire connections.
	LinkKey kem.PrivateKey

	// LogBackend is the `core/log` Backend instance to use for logging.
	LogBackend *log.Backend

	// Authorities is the set of Directory Authority servers.
	Authorities []*config.Authority

	// DialContextFn is the optional alternative Dialer.DialContext function
	// to be used when creating outgoing network connections.
	DialContextFn func(ctx context.Context, network, address string) (net.Conn, error)

	// Geo is the geometry used for the Sphinx packet construction.
	Geo *geo.Geometry

	// Network timeouts, in seconds.
	DialTimeoutSec      int
	HandshakeTimeoutSec int
	ResponseTimeoutSec  int

	// Retry configuration.
	RetryMaxAttempts int
	RetryBaseDelay   time.Duration
	RetryMaxDelay    time.Duration
	RetryJitter      float64
}

Config is the configuration for a voting authority pki.PostingClient instance.

type PeerResponse added in v0.0.58

type PeerResponse struct {
	Peer     *config.Authority
	Response commands.Command
	Error    error
}

Jump to

Keyboard shortcuts

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