ClaudeCode.Sandbox.Network (ClaudeCode v0.29.0)

View Source

Network isolation settings for sandbox configuration.

Maps to the SandboxNetworkConfig type in the TS SDK.

Fields

  • :allowed_domains - Domains to allow for outbound network traffic. Supports wildcards (e.g., *.example.com).
  • :allow_managed_domains_only - (Managed settings only) Only managed settings' allowedDomains and WebFetch allow rules are respected.
  • :allow_unix_sockets - Unix socket paths accessible in sandbox (SSH agents, etc.).
  • :allow_all_unix_sockets - Allow all Unix socket connections in sandbox.
  • :allow_local_binding - Allow binding to localhost ports (macOS only).
  • :http_proxy_port - HTTP proxy port if bringing your own proxy.
  • :socks_proxy_port - SOCKS5 proxy port if bringing your own proxy.

Examples

iex> ClaudeCode.Sandbox.Network.new(allowed_domains: ["*.example.com"], allow_local_binding: true)
%ClaudeCode.Sandbox.Network{allowed_domains: ["*.example.com"], allow_managed_domains_only: nil, allow_unix_sockets: nil, allow_all_unix_sockets: nil, allow_local_binding: true, http_proxy_port: nil, socks_proxy_port: nil}

Summary

Functions

Creates a new Network struct.

Converts to the camelCase map expected by the CLI.

Types

t()

@type t() :: %ClaudeCode.Sandbox.Network{
  allow_all_unix_sockets: boolean() | nil,
  allow_local_binding: boolean() | nil,
  allow_managed_domains_only: boolean() | nil,
  allow_unix_sockets: [String.t()] | nil,
  allowed_domains: [String.t()] | nil,
  http_proxy_port: non_neg_integer() | nil,
  socks_proxy_port: non_neg_integer() | nil
}

Functions

new(opts)

@spec new(keyword() | map()) :: t()

Creates a new Network struct.

Accepts a keyword list or map (atom or string keys). Unknown keys are ignored.

to_settings_map(net)

@spec to_settings_map(t()) :: map()

Converts to the camelCase map expected by the CLI.