client

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2026 License: MIT Imports: 10 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package client is a small HTTP client for fpga-gzipd. It supports both Unix-domain and TCP endpoints and streams request/response bodies without buffering the compressed object in memory.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client talks to one fpga-gzipd endpoint.

func NewHTTP

func NewHTTP(baseURL string, hc *http.Client, options ...Option) (*Client, error)

NewHTTP creates a client from an HTTP base URL. If hc is nil, a client with a default transport is used. This is useful for tests and for callers that already configure TLS, proxies or connection pooling.

func NewTCP

func NewTCP(addr string, options ...Option) (*Client, error)

NewTCP creates a client for a daemon listening on host:port.

func NewUnix

func NewUnix(path string, options ...Option) (*Client, error)

NewUnix creates a client using a Unix-domain socket.

func (*Client) CloseIdleConnections

func (c *Client) CloseIdleConnections()

CloseIdleConnections releases pooled TCP or Unix transport connections.

func (*Client) Compress

func (c *Client) Compress(ctx context.Context, src io.Reader, inputSize int64, dst io.Writer) (Result, error)

Compress streams exactly inputSize bytes from src to fpga-gzipd and copies the gzip response to dst. The caller must provide the complete input size; a non-rewindable reader is supported.

func (*Client) CompressAlgorithm added in v0.0.3

func (c *Client) CompressAlgorithm(ctx context.Context, algorithm firmware.Algorithm, src io.Reader, inputSize int64, dst io.Writer) (Result, error)

CompressAlgorithm checks image selection and the final verification trailer. A late DMA or integrity error cannot be mistaken for successful HTTP output.

func (*Client) Health

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

Health checks the daemon's readiness endpoint.

type Option

type Option func(*Client) error

Option customizes a Client at construction time.

func WithAuth

func WithAuth(token string) Option

WithAuth configures an optional Bearer token for daemon requests. An empty token is rejected; omit this option to leave authentication disabled.

type Result

type Result struct {
	InputBytes  int64
	OutputBytes int64
	Algorithm   firmware.Algorithm
}

Result describes one completed service request.

Jump to

Keyboard shortcuts

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