createProxyAgent()
SIP Protocol API Reference v0.7.4
SIP Protocol API Reference / createProxyAgent
Function: createProxyAgent()
Section titled “Function: createProxyAgent()”createProxyAgent(
config,options?):Promise<Agent|undefined>
Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:16941
Create a proxy agent for HTTP requests
Note: This requires optional dependencies:
socks-proxy-agentfor SOCKS4/5 proxieshttps-proxy-agentfor HTTP/HTTPS proxies
Install with: npm install socks-proxy-agent https-proxy-agent
Parameters
Section titled “Parameters”config
Section titled “config”Proxy configuration
options?
Section titled “options?”Agent options
Returns
Section titled “Returns”Promise<Agent | undefined>
HTTP Agent configured for proxy, or undefined for direct connection
Throws
Section titled “Throws”Error if proxy dependencies not installed
Example
Section titled “Example”// Using Torconst agent = await createProxyAgent('tor')
// Using custom SOCKS5const agent = await createProxyAgent('socks5://127.0.0.1:1080')
// Use with fetchfetch(url, { agent })