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

Typical flow

SandboxBuilder

proxy()

Select and configure the single outbound proxy for the sandbox. The callback receives an OutboundProxyBuilder and must return one protocol-specific builder. Invalid addresses throw while applying the callback.

OutboundProxyBuilder

Protocol selector passed to SandboxBuilder.proxy().

socks4()

Select a SOCKS4 proxy at IP:port. The returned builder can optionally set a user ID.

socks5()

Select a SOCKS5 proxy at IP:port. The parent sandbox builder validates and materializes the returned Socks5ProxyBuilder.

Socks4ProxyBuilder

Protocol-specific builder returned by OutboundProxyBuilder.socks4().

userId()

Set the optional SOCKS4 user ID. It must contain 1–255 bytes and no null byte. A user ID identifies the caller; it is not a password.

Socks5ProxyBuilder

Protocol-specific builder returned by OutboundProxyBuilder.socks5(). It carries the proxy address and is finalized when returned from the .proxy() callback.

credentials()

Set optional SOCKS5 username/password authentication. Pass SecretSource.env("SOCKS5_PASSWORD") as password. The username and resolved password must each contain 1–255 bytes. 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.

SecretSource

env()

Create a host environment-variable reference for a SOCKS5 password. Import SecretSource from microsandbox.

OutboundProxy

Discriminated outbound proxy value stored in the sandbox’s durable network specification. A SOCKS5 password remains a SecretSource reference in this value; the resolved password is runtime-only.