kit

module
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2026 License: Apache-2.0

README

kit

Small, dependency-free Go packages for infrastructure tooling: SSRF-safe outbound HTTP, cron schedules, health probes, log parsing, and similar building blocks. Extracted from, and used in production by, the Levelrail platform.

Install

go get github.com/GLINCKER/levelrail/kit@latest

Requires Go 1.24 or newer. Import a single package, for example github.com/GLINCKER/levelrail/kit/cronexpr.

Packages

Package What it does
netguard HTTP client and URL validation that refuse loopback, private, and other internal addresses (SSRF protection).
untrusted Cleans, redacts, truncates, and wraps untrusted text before it goes into an LLM prompt.
cronexpr Parses 5-field cron expressions and computes the next run time, in UTC or a given time zone.
pathfilter Doublestar-style include and ignore globs for deciding whether changed paths should trigger a build.
probe Exec and HTTP health probe configuration, validation, and a runner with readiness polling.
slowquery Parsers for Postgres and MySQL slow-query log lines.
forecast Projects when a disk will fill using a least-squares fit over usage samples.
diskspace Free and total bytes for a path on Unix and Windows, plus byte formatting.
ticker Runs a function on an interval until its context is cancelled, logging errors.
dockerhub Minimal client for Docker Hub repository search and tag listing.
stackdetect Detects a project's framework and build method from its files.
firewall Reconciles prefix-tagged ufw rules against a desired set, with lockout-safety checks.
semver Compares release version strings by semantic-versioning precedence.
upgrade Fetches the latest release for stable, beta and edge channels from a GitHub repo and compares versions.

Stability

The module is v0.x. The API may change between minor versions, and there is no compatibility promise yet.

Dependencies

Every package uses the Go standard library only. The module has no third-party requirements, and that is kept as a rule.

Contributing

See CONTRIBUTING.md in the repository root. Changes to kit/ go through the same pull request flow as the rest of the repository.

License

Apache-2.0. See LICENSE.

Directories

Path Synopsis
Package cronexpr parses standard 5-field cron expressions ("minute hour day-of-month month day-of-week") and computes the next matching time, in UTC or in a given time zone.
Package cronexpr parses standard 5-field cron expressions ("minute hour day-of-month month day-of-week") and computes the next matching time, in UTC or in a given time zone.
Package diskspace reports free and total bytes of the filesystem holding a path, on Unix and Windows, and formats byte counts for display.
Package diskspace reports free and total bytes of the filesystem holding a path, on Unix and Windows, and formats byte counts for display.
Package dockerhub is a minimal client for Docker Hub's public, unauthenticated API: repository search and tag listing.
Package dockerhub is a minimal client for Docker Hub's public, unauthenticated API: repository search and tag listing.
Package firewall manages host ufw rules as declarative allow/deny records.
Package firewall manages host ufw rules as declarative allow/deny records.
Package forecast projects when a resource such as a disk will fill, using an ordinary least-squares line fit over (timestamp, bytes used) samples.
Package forecast projects when a resource such as a disk will fill, using an ordinary least-squares line fit over (timestamp, bytes used) samples.
Package netguard builds HTTP clients and validates URLs for user-configured outbound requests such as webhooks, refusing loopback, private, link-local, and other internal addresses to prevent server-side request forgery.
Package netguard builds HTTP clients and validates URLs for user-configured outbound requests such as webhooks, refusing loopback, private, link-local, and other internal addresses to prevent server-side request forgery.
Package pathfilter matches changed file paths against doublestar-style globs with include and ignore lists, for deciding whether a change in a monorepo should trigger a build or deploy.
Package pathfilter matches changed file paths against doublestar-style globs with include and ignore lists, for deciding whether a change in a monorepo should trigger a build or deploy.
Package probe runs readiness and liveness checks against a container: an HTTP(S) request to its address, or a command executed inside it.
Package probe runs readiness and liveness checks against a container: an HTTP(S) request to its address, or a command executed inside it.
Package semver compares release version strings such as "v1.2.3" or "0.4.0-beta.2" by semantic-versioning precedence.
Package semver compares release version strings such as "v1.2.3" or "0.4.0-beta.2" by semantic-versioning precedence.
Package slowquery parses Postgres and MySQL slow-query log lines into structured entries with a timestamp, duration, and query text.
Package slowquery parses Postgres and MySQL slow-query log lines into structured entries with a timestamp, duration, and query text.
Package stackdetect inspects a local project directory and guesses its framework and how to build it (Dockerfile, Compose, Node.js, Go, Java, Python, or static site), without executing anything from the project.
Package stackdetect inspects a local project directory and guesses its framework and how to build it (Dockerfile, Compose, Node.js, Go, Java, Python, or static site), without executing anything from the project.
Package ticker runs a function at a fixed interval until its context is cancelled, logging tick errors instead of stopping.
Package ticker runs a function at a fixed interval until its context is cancelled, logging tick errors instead of stopping.
Package untrusted prepares attacker-influenced text such as logs, environment values, and commit messages for an LLM prompt: it strips terminal and invisible characters, redacts obvious secrets, truncates, and wraps the result in a delimited block marked as data.
Package untrusted prepares attacker-influenced text such as logs, environment values, and commit messages for an LLM prompt: it strips terminal and invisible characters, redacts obvious secrets, truncates, and wraps the result in a delimited block marked as data.
Package upgrade fetches the latest release for stable, beta and edge channels from a GitHub repo, compares versions, and runs the read-only checks that gate a self-upgrade.
Package upgrade fetches the latest release for stable, beta and edge channels from a GitHub repo, compares versions, and runs the read-only checks that gate a self-upgrade.

Jump to

Keyboard shortcuts

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