neokit

module
v0.0.10 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2026 License: MIT

README

neokit

Small, domain-free Go building blocks extracted from NeoGate, a private household server project: structured logging, an HTTP client with retries and SSRF guarding, GoFiber helpers, a stale-while-revalidate cache, and a SQLite migration runner.

Pre-1.0: the API may change between v0.x releases.

Packages

Package What
logx slog context handler, canonical Err attribute, request-id propagation
httpc NewHTTPClient, BaseClient, retry transport, APIError, Classify, SSRF guard
fiberx {"error": …} envelope, bind+validate, metrics/logging middleware, rate limiters
cache stale-while-revalidate GetOrFetch
sqlitex PRAGMA user_version append-only migration runner, VACUUM INTO snapshot backup
tracing metrics OpenTelemetry and Prometheus wiring
safe ids clock goroutine recovery, id/token generation, injectable clock
netx AddrInUseHint — a readable message for a listener already bound
disk Usage — free/total filesystem space via syscall.Statfs

MIT.

Directories

Path Synopsis
Package cache provides a tiny in-memory TTL cache with per-key single-flight and stale-while-revalidate refreshes.
Package cache provides a tiny in-memory TTL cache with per-key single-flight and stale-while-revalidate refreshes.
Package disk reports free and total space on the filesystem holding a file.
Package disk reports free and total space on the filesystem holding a file.
Package fiberx holds cross-cutting Fiber v3 HTTP helpers: the error envelope, request binding/validation, metrics+logging middleware, rate limiting and optimistic-concurrency helpers.
Package fiberx holds cross-cutting Fiber v3 HTTP helpers: the error envelope, request binding/validation, metrics+logging middleware, rate limiting and optimistic-concurrency helpers.
Package httpc is the HTTP client core: a BaseClient for JSON APIs with built-in retries, bearer-token injection/refresh, and bounded reads; a Fault classification (see fault.go) that turns an error into "what should the caller do about it" instead of a status code to grep; and an SSRF-guarded transport (see ssrf.go) for fetching URLs a caller only partly controls.
Package httpc is the HTTP client core: a BaseClient for JSON APIs with built-in retries, bearer-token injection/refresh, and bounded reads; a Fault classification (see fault.go) that turns an error into "what should the caller do about it" instead of a status code to grep; and an SSRF-guarded transport (see ssrf.go) for fetching URLs a caller only partly controls.
Package ids generates identifiers and secrets: UUIDGenerator for v4 UUIDs and CryptoTokenGenerator (see tokengen.go) for crypto-random tokens and passwords.
Package ids generates identifiers and secrets: UUIDGenerator for v4 UUIDs and CryptoTokenGenerator (see tokengen.go) for crypto-random tokens and passwords.
Package logx holds the small slog helpers that make logs correlatable and consistent: a request-ID carried on the context, a handler decorator that stamps it onto every record, and a canonical error attribute.
Package logx holds the small slog helpers that make logs correlatable and consistent: a request-ID carried on the context, a handler decorator that stamps it onto every record, and a canonical error attribute.
Package metrics wires the OpenTelemetry metrics pillar — the sibling of package tracing, and the third leg (with tracing plus the trace-correlated logs logx already emits) of a full traces + metrics + logs setup.
Package metrics wires the OpenTelemetry metrics pillar — the sibling of package tracing, and the third leg (with tracing plus the trace-correlated logs logx already emits) of a full traces + metrics + logs setup.
Package netx holds small, dependency-free network helpers.
Package netx holds small, dependency-free network helpers.
Package safe guards background work that runs outside a request's own recover middleware — schedulers, event hooks, detached goroutines — so a panic there is logged with a stack trace and contained, rather than crashing the whole process or silently ending that one goroutine forever.
Package safe guards background work that runs outside a request's own recover middleware — schedulers, event hooks, detached goroutines — so a panic there is logged with a stack trace and contained, rather than crashing the whole process or silently ending that one goroutine forever.
Package sqlitex holds SQLite mechanism with no schema of its own.
Package sqlitex holds SQLite mechanism with no schema of its own.
Package tracing wires OpenTelemetry distributed tracing for the HTTP server.
Package tracing wires OpenTelemetry distributed tracing for the HTTP server.

Jump to

Keyboard shortcuts

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