Documentation
¶
Overview ¶
Package transport wires the REST (oapi-codegen) and Connect-RPC clients used by the public e2b package. Everything here is internal: the exported helpers are thin constructors consumed by sandbox.go, volume/, etc.
Index ¶
- func ConnectCode(err error) connect.Code
- func IsConnectCode(err error, code connect.Code) bool
- func NewAPIClient(baseURL string, hc *http.Client, auth Auth) (*apiclient.Client, error)
- func NewVolumeAPIClient(baseURL string, hc *http.Client, token string, extraHeaders map[string]string) (*volumeapi.Client, error)
- type Auth
- type EnvdAuth
- type EnvdClients
- type HTTPError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConnectCode ¶
ConnectCode extracts the Connect code if present; otherwise returns connect.CodeUnknown.
func IsConnectCode ¶
IsConnectCode reports whether err is a Connect-RPC error with the given code.
func NewAPIClient ¶
NewAPIClient builds the control-plane REST client (https://api.<domain>).
Types ¶
type Auth ¶
Auth describes how to authenticate against the control-plane REST API. Exactly one of APIKey or AccessToken should be set (APIKey wins if both).
func (Auth) AsRequestEditor ¶
func (a Auth) AsRequestEditor() apiclient.RequestEditorFn
AsRequestEditor builds a RequestEditorFn that injects the auth header and any extra headers the caller supplied.
type EnvdAuth ¶
EnvdAuth is the envd (in-sandbox) access token. It is returned by the control plane when the sandbox is created. For Connect-RPC the token is carried as HTTP Basic auth with the token placed in the *username* slot. For plain HTTP endpoints (/files, /metrics, /envs) the token goes in an X-Access-Token header.
type EnvdClients ¶
type EnvdClients struct {
Process processconnect.ProcessClient
Filesystem filesystemconnect.FilesystemClient
API *envdapi.Client
}
NewEnvdClients builds the two Connect-RPC clients used by the sandbox (Process + Filesystem) plus the plain-HTTP client for /files, /metrics, /envs. baseURL is the envd root URL (https://49983-<id>.<domain>).
func NewEnvdClients ¶
NewEnvdClients constructs Connect and REST clients for envd traffic.
type HTTPError ¶
HTTPError captures an unexpected HTTP response so the caller can classify it into the right SDK error type.
func ReadHTTPError ¶
ReadHTTPError parses an HTTP response body into an HTTPError. It does not close the body — the caller owns it.