Skip to main content
Configure one HTTP CONNECT, SOCKS4, or SOCKS5 proxy for outbound sandbox connections with WithProxy. Proxy protocols are mutually exclusive. See Proxies for routing behavior, security considerations, and limits.
Outbound proxies are local-only. Cloud sandbox creation rejects this setting.

Typical flow

Functions

m.WithProxy()

Set the single proxy used for outbound sandbox connections.

Parameters

Protocol-specific outbound proxy configuration.

m.SOCKS4Proxy()

Construct a SOCKS4 proxy at IP:port for WithProxy. Pass SOCKS4ProxyOptions{UserID: "sandbox"} to include the optional SOCKS4 user ID. It must contain 1–255 bytes and no null byte; it is an identifier, not a password.

m.HTTPConnectProxy()

Construct an HTTP CONNECT proxy at IP:port for WithProxy. It supports TCP only. Call Credentials on the result to enable optional HTTP Basic authentication.

m.SOCKS5Proxy()

Construct a SOCKS5 proxy at IP:port for WithProxy.

(*OutboundProxy).Credentials()

Return a copy configured with SOCKS5 or HTTP CONNECT username/password authentication. Call this on a value returned by SOCKS5Proxy or HTTPConnectProxy and pass SecretSourceEnv("SOCKS5_PASSWORD") or SecretSourceEnv("HTTP_CONNECT_PASSWORD") as password. HTTP CONNECT accepts an empty username for token-only authentication. A non-empty username must not contain : or control characters. The host environment variable is read once each time the sandbox starts. Changing it affects the next start, not a sandbox that is already running. ConfigJSON() and the database contain the source reference but never the resolved password. For SOCKS5, the username and resolved password must each contain 1–255 bytes.

m.SecretSourceEnv()

Create a host environment-variable reference for a SOCKS5 or HTTP CONNECT password.

OutboundProxy

Opaque outbound proxy configuration constructed with a protocol-specific function. Pass it to WithProxy.

SecretSource

Opaque host-side secret source constructed with SecretSourceEnv. Durable configuration contains this source reference, not the resolved password.

SOCKS4ProxyOptions