# rofl0r/proxychains-ng architecture

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

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

## Overview

Proxychains-NG is a preload-based TCP proxying tool: a user launches a dynamically linked program through its wrapper, libc networking hooks redirect connections through configured proxy chains, and DNS can be resolved through proxy-aware mechanisms. Configuration also controls chain selection, local-network exclusions and destination translation. The repository documents SOCKS4a/5 and HTTP support, legacy DNS behavior, and an experimental DNS daemon. Some subsystem links below rely on README statements because their implementation files were not excerpted.

Main entry points: [`src/libproxychains.c`](https://github.com/rofl0r/proxychains-ng/blob/master/src/libproxychains.c) (Libc hooks), [`src/daemon/daemon.c`](https://github.com/rofl0r/proxychains-ng/blob/master/src/daemon/daemon.c) (Remote DNS daemon), [`src/main.c`](https://github.com/rofl0r/proxychains-ng/blob/master/src/main.c) (Proxychains launcher), [`src/rdns.c`](https://github.com/rofl0r/proxychains-ng/blob/master/src/rdns.c) (Remote DNS resolver)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_launch["Launch and configuration"]
  node_launcher["Proxychains launcher<br/>[main.c]"]
  node_config["Chain configuration<br/>[libproxychains.c]"]
  node_config_file["Proxychains config<br/>[proxychains.conf]"]
end

subgraph group_intercept["Network interception"]
  node_preload["Libc hooks<br/>[libproxychains.c]"]
  node_dns_hooks["DNS hooks<br/>[libproxychains.c]"]
end

subgraph group_proxy["Proxy routing"]
  node_core["Proxy-chain engine<br/>[core.c]"]
end

subgraph group_dns["DNS resolution"]
  node_proxyresolv["Proxy DNS command"]
  node_rdns["Remote DNS resolver<br/>[rdns.c]"]
  node_ip_map[("DNS address mapping<br/>[allocator_thread.c]")]
  node_dns_daemon["Remote DNS daemon<br/>[daemon.c]"]
  node_daemon_udp["UDP server<br/>[udpserver.c]"]
  node_daemon_hosts[("Daemon host index<br/>[hsearch.c]")]
  node_daemon_list[("Daemon hostname list<br/>[sblist.c]")]
end

node_user(("Program user"))
node_target_app["TCP application"]
node_proxy_servers(("Proxy servers"))

node_user -->|"launches"| node_launcher
node_launcher -->|"runs proxied"| node_target_app
node_launcher -->|"preloads"| node_preload
node_config_file -->|"configures"| node_config
node_preload -->|"parses"| node_config
node_preload -->|"routes connections"| node_core
node_core -->|"connects through"| node_proxy_servers
node_preload -->|"intercepts DNS"| node_dns_hooks
node_dns_hooks -->|"uses resolver"| node_rdns
node_rdns -->|"maps names"| node_ip_map
node_proxyresolv -->|"resolves through"| node_rdns
node_dns_hooks -.->|"can use daemon"| node_dns_daemon
node_dns_daemon -->|"serves requests"| node_daemon_udp
node_dns_daemon -->|"indexes hosts"| node_daemon_hosts
node_dns_daemon -->|"stores hosts"| node_daemon_list

click node_launcher "https://github.com/rofl0r/proxychains-ng/blob/master/src/main.c"
click node_config "https://github.com/rofl0r/proxychains-ng/blob/master/src/libproxychains.c"
click node_config_file "https://github.com/rofl0r/proxychains-ng/blob/master/src/proxychains.conf"
click node_preload "https://github.com/rofl0r/proxychains-ng/blob/master/src/libproxychains.c"
click node_dns_hooks "https://github.com/rofl0r/proxychains-ng/blob/master/src/libproxychains.c"
click node_core "https://github.com/rofl0r/proxychains-ng/blob/master/src/core.c"
click node_proxyresolv "https://github.com/rofl0r/proxychains-ng/blob/master/src/proxyresolv"
click node_rdns "https://github.com/rofl0r/proxychains-ng/blob/master/src/rdns.c"
click node_ip_map "https://github.com/rofl0r/proxychains-ng/blob/master/src/allocator_thread.c"
click node_dns_daemon "https://github.com/rofl0r/proxychains-ng/blob/master/src/daemon/daemon.c"
click node_daemon_udp "https://github.com/rofl0r/proxychains-ng/blob/master/src/daemon/udpserver.c"
click node_daemon_hosts "https://github.com/rofl0r/proxychains-ng/blob/master/src/daemon/hsearch.c"
click node_daemon_list "https://github.com/rofl0r/proxychains-ng/blob/master/src/daemon/sblist.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_launcher,node_config,node_config_file,node_user toneBlue
class node_preload,node_dns_hooks toneAmber
class node_core,node_proxy_servers toneMint
class node_proxyresolv,node_rdns,node_ip_map,node_dns_daemon,node_daemon_udp,node_daemon_hosts,node_daemon_list toneRose
class node_target_app toneIndigo
```

## Components

### Launch and configuration

- [Proxychains launcher](https://github.com/rofl0r/proxychains-ng/blob/master/src/main.c): `src/main.c`
- [Chain configuration](https://github.com/rofl0r/proxychains-ng/blob/master/src/libproxychains.c): `src/libproxychains.c`
- [Proxychains config](https://github.com/rofl0r/proxychains-ng/blob/master/src/proxychains.conf): `src/proxychains.conf`

### Network interception

- [Libc hooks](https://github.com/rofl0r/proxychains-ng/blob/master/src/libproxychains.c): `src/libproxychains.c`
- [DNS hooks](https://github.com/rofl0r/proxychains-ng/blob/master/src/libproxychains.c): `src/libproxychains.c`

### Proxy routing

- [Proxy-chain engine](https://github.com/rofl0r/proxychains-ng/blob/master/src/core.c): `src/core.c`

### DNS resolution

- [Proxy DNS command](https://github.com/rofl0r/proxychains-ng/blob/master/src/proxyresolv): `src/proxyresolv`
- [Remote DNS resolver](https://github.com/rofl0r/proxychains-ng/blob/master/src/rdns.c): `src/rdns.c`
- [DNS address mapping](https://github.com/rofl0r/proxychains-ng/blob/master/src/allocator_thread.c): `src/allocator_thread.c`
- [Remote DNS daemon](https://github.com/rofl0r/proxychains-ng/blob/master/src/daemon/daemon.c): `src/daemon/daemon.c`
- [UDP server](https://github.com/rofl0r/proxychains-ng/blob/master/src/daemon/udpserver.c): `src/daemon/udpserver.c`
- [Daemon host index](https://github.com/rofl0r/proxychains-ng/blob/master/src/daemon/hsearch.c): `src/daemon/hsearch.c`
- [Daemon hostname list](https://github.com/rofl0r/proxychains-ng/blob/master/src/daemon/sblist.c): `src/daemon/sblist.c`

### Other components

- **Program user**
- **TCP application**
- **Proxy servers**

## Connections

- Program user → Proxychains launcher: launches (evidence: `README`)
- Proxychains launcher → TCP application: runs proxied (evidence: `README`)
- Proxychains launcher → Libc hooks: preloads (evidence: `README`)
- Proxychains config → Chain configuration: configures (evidence: `src/libproxychains.c`)
- Libc hooks → Chain configuration: parses (evidence: `src/libproxychains.c`)
- Libc hooks → Proxy-chain engine: routes connections (evidence: `src/libproxychains.c`)
- Proxy-chain engine → Proxy servers: connects through (evidence: `README`)
- Libc hooks → DNS hooks: intercepts DNS (evidence: `README`)
- DNS hooks → Remote DNS resolver: uses resolver (evidence: `src/libproxychains.c`)
- Remote DNS resolver → DNS address mapping: maps names (evidence: `src/rdns.c`)
- Proxy DNS command → Remote DNS resolver: resolves through (evidence: `README`)
- DNS hooks → Remote DNS daemon: can use daemon
- Remote DNS daemon → UDP server: serves requests (evidence: `src/daemon/daemon.c`)
- Remote DNS daemon → Daemon host index: indexes hosts (evidence: `src/daemon/daemon.c`)
- Remote DNS daemon → Daemon hostname list: stores hosts (evidence: `src/daemon/daemon.c`)
