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 ¶
- Variables
- type Client
- func (c *Client) Push(ctx context.Context, snap *proxywire.Snapshot) error
- func (c *Client) ReloadCerts(ctx context.Context) error
- func (c *Client) Start(ctx context.Context)
- func (c *Client) Status(ctx context.Context) (*proxywire.Status, error)
- func (c *Client) WaitReady(ctx context.Context, timeout time.Duration) error
Constants ¶
This section is empty.
Variables ¶
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 (*Client) Push ¶
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 ¶
ReloadCerts tells the proxy to reload certificates from disk.
func (*Client) Start ¶
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.