# Test a proxy connection with curl

Authentication, export, and DNS authentication via HTTP, HTTPS CONNECT, and SOCKS5 TCP minimum commands.

curl is suitable for building minimal, reproducible tests. The current valid configuration is obtained from the console and passed to the controlled terminal via environment variables.

## HTTP/HTTPS Testing

```bash
curl --proxy 'http://us.zzhttp.com:7878' \
  --proxy-user "$PROXY_USERNAME:$PROXY_PASSWORD" \
  --connect-timeout 10 --max-time 30 \
  'https://ipinfo.io/json'
```

## SOCKS5 TCP testing

```bash
curl --proxy 'socks5h://us.zzhttp.com:7878' \
  --proxy-user "$PROXY_USERNAME:$PROXY_PASSWORD" \
  --connect-timeout 10 --max-time 30 \
  'https://ipinfo.io/json'
```

## Prepare

- Copy the full proxy username and sub-username and password from the console and inject them separately `PROXY_USERNAME` and `PROXY_PASSWORD`; Do not return values in the command history and CI logs.
- Detection target returns JSON `ip`, `country` and `region` Fields. Areas are used for initial checks and third-party databases may be biased.
- IPinfo open detection interface may limit flow. Received from target station `429` The server is not able to resolve the problem.

## HTTP and HTTPS

- When accessing HTTPS targets using an HTTP proxy, curl establishes a CONNECT tunnel.
- The request is not confirmed by the public network export field.

## SOCKS5

- Domain Name Target Use `socks5h` Let the proxy side resolve the DNS.
- Tests only TCP requests.

## Judgment

- Check DNS, TCP, 407, CONNECT, TLS, and target statuses in order.
- Desensitization information is stored, but no authentication header.

html pre.shiki code .sScJk, html code.shiki .sScJk{--shiki-default:#6F42C1;--shiki-dark:#B392F0}html pre.shiki code .sj4cs, html code.shiki .sj4cs{--shiki-default:#005CC5;--shiki-dark:#79B8FF}html pre.shiki code .sZZnC, html code.shiki .sZZnC{--shiki-default:#032F62;--shiki-dark:#9ECBFF}html pre.shiki code .sVt8B, html code.shiki .sVt8B{--shiki-default:#24292E;--shiki-dark:#E1E4E8}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}
