drift Docs
Start
What is Drift?
The tour, if you are new here.
Why Drift?
The case for a smaller cloud.
Getting started
Nothing to deployed, in one command.
Architecture
How a slice is put together.
What it costs
The free grant, five unit prices, two rules.
Build
Canvas
Static sites, same origin as your API.
Tools
Operate
Auth
Accounts, tokens and scopes.
Security
Boundaries, sandboxing and hardening.

Utilities & cross-slice

What sits at the SDK's top level, beside Backbone and Deed rather than inside either.

Signatures

Go
// Outbound HTTP, egress-gated. Status 0 means the request never left the process.
HTTPRequest(method, url string, headers map[string]string, body []byte) (*HTTPResponse, error)
HTTPRequestWithTimeout(method, url string, headers map[string]string, body []byte, timeout time.Duration) (*HTTPResponse, error)

type HTTPResponse struct { Status int; Body []byte }   // no headers, status and body only

// drift.Slice(name): a slice you linked with `drift slice link add`.
// An unlinked name errors before any network I/O.
Get(path string) (*HTTPResponse, error)
Post(path string, body any) (*HTTPResponse, error)                                  // JSON-encodes body
Request(method, path string, headers map[string]string, body []byte) (*HTTPResponse, error)

CallerSlice(req Request) string   ·   Env(key string) string   ·   Log(msg string)

Outbound HTTP

The default timeout is 30 seconds; HTTPRequestWithTimeout takes your own. Private address space is unreachable whatever your Driftfile says: RFC-1918, link-local (including the cloud metadata endpoint) and CGNAT are excepted from the slice's outbound rule.

Rust: outbound HTTPS needs the tls feature.

The default Rust build pulls ureq with default-features = false, so it is pure Rust and cross-compiles with rustup alone. In that build an https:// URL returns (0, "drift-sdk: outbound HTTPS needs the \"tls\" feature …") without a request ever leaving the process, so check the status and don't assume the call happened. Enabling features = ["tls"] pulls ring (C and assembly), and deploys then need a C cross-toolchain such as zig.

Cross-slice

All three Slice methods inject the X-Drift-Slice identity header, which is what the far end reads back with CallerSlice. Your own headers override it only by setting the same key.

Cross-slice calling is deliberately not under Backbone, because it is inter-slice networking, the seed of a different, hypothetical future pillar. Not to be confused with Deed.Link, which enrolls a device for one identity.

Environment

Env exists in all six SDKs and returns an empty string for a missing key. Reaching past it for the language's own accessor changes that: Python's os.environ[key] raises KeyError rather than returning "". For secrets specifically, use Secret.Get rather than either, because it resolves the value whichever way the runtime delivered it.