proxyclient

package
v0.1.0-beta.69 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package proxyclient is haloyd's client for the haloy-proxy control API. Every push first writes the snapshot file (the proxy's durable last-known-good boot config), then delivers the snapshot over the control socket. A background reconcile loop re-pushes after the proxy restarts or a push fails, so the two processes converge without haloyd ever crashing on an unreachable proxy.

Index

Constants

This section is empty.

Variables

View Source
var ErrUnreachable = errors.New("haloy-proxy control socket unreachable")

ErrUnreachable wraps transport-level failures talking to the proxy control socket (proxy not running or restarting). The snapshot file is already written when this is returned, so callers should log and continue; the reconcile loop delivers the config once the proxy is back.

Functions

This section is empty.

Types

type Client

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

Client pushes routing snapshots to haloy-proxy.

func New

func New(dataDir string, logger *slog.Logger) *Client

New creates a client for the control socket under dataDir.

func (*Client) Push

func (c *Client) Push(ctx context.Context, snap *proxywire.Snapshot) error

Push durably records the snapshot and delivers it to the proxy.

The snapshot is validated, written to the snapshot file first (so a proxy restart converges even if the socket push fails), then PUT to the control socket. A transport failure is returned wrapped in ErrUnreachable; any other error means the config was not accepted and must be treated as real.

func (*Client) ReloadCerts

func (c *Client) ReloadCerts(ctx context.Context) error

ReloadCerts tells the proxy to reload certificates from disk.

func (*Client) Start

func (c *Client) Start(ctx context.Context)

Start launches the background reconcile loop. On every tick, if the proxy is reachable and its config hash differs from the last pushed snapshot (failed push, proxy restart, schema recovery), the snapshot is re-pushed. The loop stops when ctx is cancelled.

func (*Client) Status

func (c *Client) Status(ctx context.Context) (*proxywire.Status, error)

Status fetches the proxy's current status.

func (*Client) WaitReady

func (c *Client) WaitReady(ctx context.Context, timeout time.Duration) error

WaitReady polls the proxy until it answers status requests, so ACME challenges have a live route to the challenge server before certificate issuance starts.

Jump to

Keyboard shortcuts

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