internal

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2026 License: MIT Imports: 8 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 internal holds the helpers shared by the packages of this module that are not part of the public API.

Index

Constants

View Source
const RedactedURL = "[REDACTED]"

RedactedURL replaces the URL of an error that must not leak it.

Variables

This section is empty.

Functions

func ContextOrBackground added in v0.2.0

func ContextOrBackground(ctx context.Context) context.Context

ContextOrBackground returns ctx, or the background context when ctx is nil. Passing a nil context is a mistake of the caller (staticcheck SA1012), the entry points of the library tolerate it rather than panic.

func DefaultHTTPClient

func DefaultHTTPClient() *http.Client

DefaultHTTPClient returns an HTTP client with the default timeout.

func HTTPClientWithTimeout

func HTTPClientWithTimeout(timeout time.Duration) *http.Client

HTTPClientWithTimeout returns an HTTP client with the given timeout.

func LoggerOrDiscard added in v0.2.0

func LoggerOrDiscard(logger *slog.Logger) *slog.Logger

LoggerOrDiscard returns logger, or a logger that discards everything when logger is nil: the entry points that take a logger give their components a usable one, so that none of them needs to check for nil.

func NewHTTPClient

func NewHTTPClient(timeout time.Duration, transport http.RoundTripper) *http.Client

NewHTTPClient returns an HTTP client with the given timeout and transport.

func RedactURL

func RedactURL(raw string) string

RedactURL returns a URL that is safe to put in an error or a log: only the scheme and the host are kept. The user info, the path (tokens are sometimes carried by it), the query string and the fragment may carry credentials, so they are dropped. A value that can not be parsed is replaced entirely, because its content is unknown.

func RedactURLError

func RedactURLError(err error) error

RedactURLError removes the URLs from the errors returned by net/http and net/url.

Those errors embed the full request URL, but the URL of a webhook (Slack, Discord, ...) or of an endpoint may carry a secret (token in the path, credentials in the user info or in the query string). The operation and the root cause are kept so the error stays actionable. When the cause itself quotes a URL (for example a malformed redirect Location header), the cause is rewritten without it. The cause of a parse error is always replaced, because it quotes the unparsable input.

Types

type HTTPClient

type HTTPClient interface {
	Do(req *http.Request) (*http.Response, error)
}

HTTPClient is an interface over http.Client to make mock easier.

Directories

Path Synopsis
Package cache caches the loaded flag configurations in memory for the evaluation.
Package cache caches the loaded flag configurations in memory for the evaluation.
Package connection builds and shares the AWS clients of the relay: exactly one client per named connection (one bucket or endpoint, one region, one credentials identity) per process.
Package connection builds and shares the AWS clients of the relay: exactly one client per named connection (one bucket or endpoint, one region, one credentials identity) per process.
Package docstest holds the tests that run the examples of the documentation: the bootstrap files and control-plane documents that the pages show are valid, and the getting-started page is run command by command against the built binaries.
Package docstest holds the tests that run the examples of the documentation: the bootstrap files and control-plane documents that the pages show are valid, and the getting-started page is run command by command against the built binaries.
Package flagstate builds the state of a flag evaluation returned by the all flags and flag evaluation APIs.
Package flagstate builds the state of a flag evaluation returned by the all flags and flag evaluation APIs.
Package fleet generates a seeded deployment of many flag sets for the fleet end-to-end test (issue #84): the bootstrap file, the documents to publish (flag sets and flags) and the manifest, a list of evaluation contexts per flag set, and the result that each evaluation must give.
Package fleet generates a seeded deployment of many flag sets for the fleet end-to-end test (issue #84): the bootstrap file, the documents to publish (flag sets and flags) and the manifest, a list of evaluation contexts per flag set, and the result that each evaluation must give.
Package folderloader holds the provider independent logic of the "folder mode" of the retrievers (S3, GCS, Azure Blob...): list the files under a prefix, download and parse the ones that changed, and merge all of them into a single flag set.
Package folderloader holds the provider independent logic of the "folder mode" of the retrievers (S3, GCS, Azure Blob...): list the files under a prefix, download and parse the ones that changed, and merge all of them into a single flag set.
Package loadtest contains the flag fixtures, the exporter behaviours and the soak harness used to measure the throughput and the memory stability of semaphore.
Package loadtest contains the flag fixtures, the exporter behaviours and the soak harness used to measure the throughput and the memory stability of semaphore.
cmd/soak command
Command soak runs a max-rate load against the library or a real relay proxy (loopback HTTP), with event tracking on and a selectable exporter behaviour, and prints a time series and a "memory stable" verdict.
Command soak runs a max-rate load against the library or a real relay proxy (loopback HTTP), with event tracking on and a selectable exporter behaviour, and prints a time series and a "memory stable" verdict.
cmd/soak/soakapp
Package soakapp parses the command line and runs the load-test soak command.
Package soakapp parses the command line and runs the load-test soak command.
relay
Package relay starts an in-process relay proxy for the benchmarks and the soak harness.
Package relay starts an in-process relay proxy for the benchmarks and the soak harness.
segments
Package segments holds the load and chaos tests of the dynamic segments against a real Valkey and a real relay proxy, started from the harness in internal/loadtest/relay.
Package segments holds the load and chaos tests of the dynamic segments against a real Valkey and a real relay proxy, started from the harness in internal/loadtest/relay.
Package manifestreader polls the control-plane manifest and delivers verified objects.
Package manifestreader polls the control-plane manifest and delivers verified objects.
readertest
Package readertest is the conformance suite of the manifest reader over a store: what a connection type gives the relay once its manifestreader.ObjectStore is plugged into a manifestreader.Reader.
Package readertest is the conformance suite of the manifest reader over a store: what a connection type gives the relay once its manifestreader.ObjectStore is plugged into a manifestreader.Reader.
statedir
Package statedir keeps the last accepted manifest and its verified objects in a directory, so a restart serves the last content even when the store is unreachable, and costs one conditional GET (a 304) and no object GET when it is not.
Package statedir keeps the last accepted manifest and its verified objects in a directory, so a restart serves the last content even when the store is unreachable, and costs one conditional GET (a 304) and no object GET when it is not.
storetest
Package storetest is the conformance suite of manifestreader.ObjectStore: the contract of a store as executable cases.
Package storetest is the conformance suite of manifestreader.ObjectStore: the contract of a store as executable cases.
Package notification dispatches the flag change notifications to the configured notifiers.
Package notification dispatches the flag change notifications to the configured notifiers.
Package protocol holds the protocol and format names shared by the production code and the tests: HTTP header names, media types, the names of the supported configuration formats and network names.
Package protocol holds the protocol and format names shared by the production code and the tests: HTTP header names, media types, the names of the supported configuration formats and network names.
Package schemadoc turns the JSON Schemas of the repository into the Markdown schema reference of the documentation.
Package schemadoc turns the JSON Schemas of the repository into the Markdown schema reference of the documentation.
Package signer signs webhook payloads with a shared secret.
Package signer signs webhook payloads with a shared secret.
Package testproxy is a small TCP forwarder for tests: it sits between a client and a server and can add a delay to every chunk, cut the open connections and refuse new ones.
Package testproxy is a small TCP forwarder for tests: it sits between a client and a server and can add a delay to every chunk, cut the open connections and refuse new ones.

Jump to

Keyboard shortcuts

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