# haad/proxychains architecture

> Architecture diagram of the GitHub repository haad/proxychains, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-06). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/haad/proxychains
- Repository: https://github.com/haad/proxychains

## Overview

ProxyChains is a preload-based UNIX proxying tool: a user launches a dynamically linked program through the wrapper, which selects configuration and preloads hooks that redirect networking through configured proxies. The runtime also supports proxied DNS, chained proxy types and selection modes, local-network bypasses, and destination rewriting. The excerpts show launcher setup, configuration lookup, hook initialization, proxy-chain mechanics, and DNS helpers; some hook-to-core wiring and the proxyresolv implementation are not excerpted, so those links are documented at README level or omitted.

Main entry points: [`src/libproxychains.c`](https://github.com/haad/proxychains/blob/master/src/libproxychains.c) (Preload hooks), [`src/main.c`](https://github.com/haad/proxychains/blob/master/src/main.c) (ProxyChains launcher), [`src/core.c`](https://github.com/haad/proxychains/blob/master/src/core.c) (Chain selection), [`src/common.c`](https://github.com/haad/proxychains/blob/master/src/common.c) (Config lookup)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_launch["Launch and setup"]
  node_client["Target program"]
  node_launcher["ProxyChains launcher<br/>[main.c]"]
  node_config_lookup["Config lookup<br/>[common.c]"]
  node_config_file["Proxy configuration<br/>[proxychains.conf]"]
end

subgraph group_intercept["Interception and DNS"]
  node_preload["Preload hooks<br/>[libproxychains.c]"]
  node_config_parse["Config parsing<br/>[libproxychains.c]"]
  node_libc["libc networking"]
  node_dns["Proxied DNS<br/>[core.c]"]
  node_dns_map[("DNS name map<br/>[core.c]")]
  node_proxyresolv["proxyresolv utility"]
end

subgraph group_proxying["Proxy routing"]
  node_chain["Chain selection<br/>[core.c]"]
  node_tunnel["Proxy negotiation<br/>[core.c]"]
end

subgraph group_endpoints["Network endpoints"]
  node_proxy(("Configured proxies"))
  node_target(("Destination host"))
end

node_user(("User"))

node_user -->|"runs"| node_launcher
node_launcher -->|"executes with preload"| node_client
node_launcher -->|"resolves config"| node_config_lookup
node_config_lookup -->|"searches"| node_config_file
node_launcher -->|"sets preload"| node_preload
node_preload -->|"initializes"| node_config_parse
node_config_parse -->|"reads"| node_config_file
node_client -->|"calls networking"| node_libc
node_preload -->|"hooks calls"| node_libc
node_preload -->|"routes connections"| node_chain
node_preload -->|"resolves names"| node_dns
node_dns -->|"stores name mapping"| node_dns_map
node_user -->|"requests lookup"| node_proxyresolv
node_proxyresolv -->|"resolves through proxy"| node_dns
node_chain -->|"connects via"| node_proxy
node_chain -->|"negotiates hops"| node_tunnel
node_tunnel -->|"requests destination"| node_target
node_proxy -->|"forwards traffic"| node_target

click node_launcher "https://github.com/haad/proxychains/blob/master/src/main.c"
click node_config_lookup "https://github.com/haad/proxychains/blob/master/src/common.c"
click node_config_file "https://github.com/haad/proxychains/blob/master/src/proxychains.conf"
click node_preload "https://github.com/haad/proxychains/blob/master/src/libproxychains.c"
click node_config_parse "https://github.com/haad/proxychains/blob/master/src/libproxychains.c"
click node_dns "https://github.com/haad/proxychains/blob/master/src/core.c"
click node_dns_map "https://github.com/haad/proxychains/blob/master/src/core.c"
click node_proxyresolv "https://github.com/haad/proxychains/blob/master/src/proxyresolv"
click node_chain "https://github.com/haad/proxychains/blob/master/src/core.c"
click node_tunnel "https://github.com/haad/proxychains/blob/master/src/core.c"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_client,node_launcher,node_config_lookup,node_config_file,node_user toneBlue
class node_preload,node_config_parse,node_libc,node_dns,node_dns_map,node_proxyresolv toneAmber
class node_chain,node_tunnel toneMint
class node_proxy,node_target toneRose
```

## Components

### Launch and setup

- **Target program**
- [ProxyChains launcher](https://github.com/haad/proxychains/blob/master/src/main.c): `src/main.c`
- [Config lookup](https://github.com/haad/proxychains/blob/master/src/common.c): `src/common.c`
- [Proxy configuration](https://github.com/haad/proxychains/blob/master/src/proxychains.conf): `src/proxychains.conf`

### Interception and DNS

- [Preload hooks](https://github.com/haad/proxychains/blob/master/src/libproxychains.c): `src/libproxychains.c`
- [Config parsing](https://github.com/haad/proxychains/blob/master/src/libproxychains.c): `src/libproxychains.c`
- **libc networking**
- [Proxied DNS](https://github.com/haad/proxychains/blob/master/src/core.c): `src/core.c`
- [DNS name map](https://github.com/haad/proxychains/blob/master/src/core.c): `src/core.c`
- [proxyresolv utility](https://github.com/haad/proxychains/blob/master/src/proxyresolv): `src/proxyresolv`

### Proxy routing

- [Chain selection](https://github.com/haad/proxychains/blob/master/src/core.c): `src/core.c`
- [Proxy negotiation](https://github.com/haad/proxychains/blob/master/src/core.c): `src/core.c`

### Network endpoints

- **Configured proxies**
- **Destination host**

### Other components

- **User**

## Connections

- User → ProxyChains launcher: runs (evidence: `README.md`)
- ProxyChains launcher → Target program: executes with preload (evidence: `src/main.c`)
- ProxyChains launcher → Config lookup: resolves config (evidence: `src/main.c`)
- Config lookup → Proxy configuration: searches (evidence: `src/common.c`)
- ProxyChains launcher → Preload hooks: sets preload (evidence: `src/main.c`)
- Preload hooks → Config parsing: initializes (evidence: `src/libproxychains.c`)
- Config parsing → Proxy configuration: reads (evidence: `src/libproxychains.c`)
- Target program → libc networking: calls networking (evidence: `README.md`)
- Preload hooks → libc networking: hooks calls (evidence: `README.md`)
- Preload hooks → Chain selection: routes connections (evidence: `README.md`)
- Preload hooks → Proxied DNS: resolves names (evidence: `src/libproxychains.c`)
- Proxied DNS → DNS name map: stores name mapping (evidence: `src/core.c`)
- User → proxyresolv utility: requests lookup (evidence: `README.md`)
- proxyresolv utility → Proxied DNS: resolves through proxy (evidence: `README.md`)
- Chain selection → Configured proxies: connects via (evidence: `README.md`)
- Chain selection → Proxy negotiation: negotiates hops (evidence: `src/core.c`)
- Proxy negotiation → Destination host: requests destination (evidence: `src/core.c`)
- Configured proxies → Destination host: forwards traffic (evidence: `README.md`)
