Skip to content

createProxyAgent()

SIP Protocol API Reference v0.15.1


SIP Protocol API Reference / createProxyAgent

createProxyAgent(config, options?): Promise<Agent | undefined>

Defined in: @sip-protocol/sdk/dist/index-GLbkPPho.d.ts:17045

Create a proxy agent for HTTP requests

Note: This requires optional dependencies:

  • socks-proxy-agent for SOCKS4/5 proxies
  • https-proxy-agent for HTTP/HTTPS proxies

Install with: npm install socks-proxy-agent https-proxy-agent

ProxyConfig

Proxy configuration

ProxyAgentOptions

Agent options

Promise<Agent | undefined>

HTTP Agent configured for proxy, or undefined for direct connection

Error if proxy dependencies not installed

// Using Tor
const agent = await createProxyAgent('tor')
// Using custom SOCKS5
const agent = await createProxyAgent('socks5://127.0.0.1:1080')
// Use with fetch
fetch(url, { agent })