Skip to main content
Pass repost.ClientOptions to the generated NewClient function. Construction validates the options and snapshots their values and environment fallbacks before it accepts sends.

Credential and endpoint precedence

Credential precedence, highest first, is APIKeyProvider resolved once per operation, a fixed APIKey, REPOST_SEND_API_KEY, then REPOST_TOKEN. A provider and a fixed key are mutually exclusive. Without a credential, the first send returns a CONFIGURATION error with NOT_SENT before touching the network. Endpoint precedence is APIURL, REPOST_API_URL, then https://api.repost.sh. The runtime appends /v1/messages when the configured base path does not already end with it. Plain HTTP is accepted only for loopback hosts. Environment values and option values are captured during construction. Later changes do not affect the client. Callback fields such as APIKeyProvider and DNSResolver are borrowed for the client’s lifetime and must be safe for concurrent use.

Client defaults

Durations must be positive whole milliseconds. Generators, IdempotencyKeyGenerator, RetryEntropy, MonotonicClock, WallClock, and Scheduler are deterministic seams intended mainly for tests. The default user agent is repost-client-go/<version>. UserAgentSuffix adds one space followed by your validated suffix.

Proxy, DNS, TLS, and mTLS

HTTPTransportOptions configures the built-in transport. The runtime copies its value structs and slices at construction. It borrows callback functions.
Only explicit http://host:port CONNECT proxies are supported. HTTP_PROXY, HTTPS_PROXY, and NO_PROXY do not alter the client. Proxy credentials are requested only after the configured proxy responds to CONNECT with 407. TLS certificate and hostname verification cannot be disabled. Custom CA certificates replace system trust rather than extending it. TLS 1.2 is the default minimum. You can restrict the maximum to TLS 1.3 and provide an allowlist of TLS 1.2 cipher suites. Client certificates enable mutual TLS. Passphrase-protected keys must use encrypted PKCS #8; deprecated RFC 1423 encrypted PEM is rejected. Set DNSResolver only when your application owns DNS policy. The callback receives the operation context and must return netip.Addr values promptly. The SDK does not cache callback results. Redirects are disabled. A custom Transport replaces socket behavior only; the runtime still owns validation, serialization, retries, deadlines, idempotency, admission, and response parsing.

Continue

Reliability

See how deadlines, retries, cancellation, and capacity settle.

Observability

Attach diagnostics, observers, metrics, and traces.

Frameworks

Own one client for the application lifecycle.