> For the complete documentation index, see [llms.txt](https://docs.ipdunar.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.ipdunar.com/products/overview/protocols.md).

# Protocols

The residential gateway speaks HTTP, HTTPS, and SOCKS5 on the same port. The protocol is detected from the client handshake — you do not configure it server-side.

## HTTP / HTTPS

The most widely supported. Both `http://` and `https://` targets work through the same connection.

```bash
# HTTP target
curl -x http://ipdunar_s1a2b3c4d5e-type-res-region-us:PASSWORD@gate.ipdunar.com:7777 \
     http://example.com

# HTTPS target (TLS to target is end-to-end)
curl -x http://ipdunar_s1a2b3c4d5e-type-res-region-us:PASSWORD@gate.ipdunar.com:7777 \
     https://example.com
```

For HTTPS targets the client sends `CONNECT example.com:443` to the proxy, which opens a TCP tunnel. ipdunar never sees the request body.

## SOCKS5

SOCKS5 is required for non-HTTP traffic (raw TCP, some DB clients, custom protocols) and is preferred by some scraping stacks for slightly lower overhead.

```bash
curl --socks5-hostname ipdunar_s1a2b3c4d5e-type-res-region-us:PASSWORD@gate.ipdunar.com:7777 \
     https://ipv4.icanhazip.com
```

`--socks5-hostname` (not `--socks5`) makes the proxy do the DNS lookup, which is what you want for geo-targeting to work correctly — otherwise the client resolves locally and leaks DNS.

### Python SOCKS5

```python
import requests

USER = "ipdunar_s1a2b3c4d5e-type-res-region-us"
PASS = "PASSWORD"
proxy = f"socks5h://{USER}:{PASS}@gate.ipdunar.com:7777"

r = requests.get(
    "https://ipv4.icanhazip.com",
    proxies={"http": proxy, "https": proxy},
    timeout=30,
)
```

Note `socks5h://` (with the `h`) — equivalent to `--socks5-hostname`, forces remote DNS.

### Node.js SOCKS5

```js
import { SocksProxyAgent } from "socks-proxy-agent";
import fetch from "node-fetch";

const agent = new SocksProxyAgent(
  "socks5://ipdunar_s1a2b3c4d5e-type-res-region-us:PASSWORD@gate.ipdunar.com:7777"
);
const res = await fetch("https://ipv4.icanhazip.com", { agent });
```

## When to prefer which

| Use case                                             | Pick                                                  |
| ---------------------------------------------------- | ----------------------------------------------------- |
| Standard HTTP/HTTPS scraping                         | HTTP/HTTPS                                            |
| Browser automation (Selenium, Playwright, Puppeteer) | HTTP/HTTPS                                            |
| Raw TCP, MQTT, custom protocols                      | SOCKS5                                                |
| Maximum throughput, minimum overhead                 | SOCKS5                                                |
| Easiest debugging                                    | HTTP/HTTPS — works with `mitmproxy`, browser devtools |

## What we do not support

* **SOCKS4 / SOCKS4a** — use SOCKS5
* **HTTP/3 (QUIC)** to the gateway — the target site can still serve HTTP/3 over the tunnel
* **Plain (non-TLS) authentication over the public internet** — credentials are always Base64-encoded by clients, but for sensitive workloads connect to the gateway over TLS (same port `7777`; gateway auto-detects)

## Common pitfalls

* **DNS leak in SOCKS5** — always use `socks5h://` / `--socks5-hostname` so the proxy resolves the target
* **HTTP-only library forced to talk HTTPS** — if your client requires `http://` proxy URL even for HTTPS targets, that's normal; only the target URL is HTTPS
* **`curl` ignoring `HTTPS_PROXY`** — make sure both `HTTP_PROXY` and `HTTPS_PROXY` are set, lowercase variants too on some Unixes


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.ipdunar.com/products/overview/protocols.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
