Skip to content

Latest commit

 

History

History
80 lines (52 loc) · 2.78 KB

README.md

File metadata and controls

80 lines (52 loc) · 2.78 KB

simtabi/cloudkit

CI License: MIT

Two badges, not four: no version is tagged yet, so there is no registry version to show, and tests and static analysis run in the one CI workflow.

A Go library for VPS and cloud provider APIs and plain SSH hosts, where every request goes through the caller's own transport.

Requires Go 1.27 or later. Shared by simtabi/dbpantry and simtabi/mesobia.

Install

No version is tagged yet. Until v0.1.0, pin a commit:

go get github.com/simtabi/cloudkit/src@main

The module lives in the repository's src/ directory, so its path ends in /src.

Quick start guide and usage

Getting started

Nothing to publish or configure. Build a cloudkit.Transport from your own round tripper and dialer: cloudkit refuses a nil one and the standard library's defaults, so your proxy, TLS and egress rules apply to every call.

Usage

Build the HTTP client an adapter uses, limited to the hosts it declares:

transport := cloudkit.Transport{HTTP: myRoundTripper, Dial: myDialer.DialContext}

client, err := cloudkit.NewHTTPClient(transport, cloudkit.EgressPolicy{
	APIHosts: []string{"api.hetzner.cloud"},
})
if err != nil {
	return err
}
// A request to any other host fails with cloudkit.ErrEgressDenied before
// myRoundTripper sees it, and redirects are refused unless listed.

Carry a token as a cloudkit.Secret, which prints as [REDACTED] in fmt, slog and JSON:

token := cloudkit.NewSecret(tokenBytes)
logger.Info("probing provider", "account", "production", "token", token) // token=[REDACTED]

Full walkthrough: docs/getting-started.md. Everything else is in the Documentation index.

Documentation

Hosted at https://opensource.simtabi.com/documentation/simtabi/cloudkit/.

Guides

  • Installation — the module path, Go version and pinning before v0.1.0
  • Getting started — transports, the registry, plans and applying them, retries, secrets and errors
  • Architecture — the rules every adapter follows, and why
  • Release — how a version is tagged and released

Reference

  • cloudkittest — the contract suite every adapter passes, the replaying recorder and the OpenAPI validator

Contributing and security

See CONTRIBUTING.md. Report vulnerabilities privately, as SECURITY.md describes; conduct is covered by CODE_OF_CONDUCT.md.

License

MIT. See LICENSE.