# 使用 Homebrew, Nix 安装 tun2proxy

查看 tun2proxy 的安装路径、可执行文件、元数据以及面向 AI 代理工作流的安全说明。

## 安装

```sh
sudo av install brew:tun2proxy
```

其他安装命令:

### macOS

- Homebrew (100%):

```sh
brew install tun2proxy
```

  证据: local Homebrew formula metadata

### Linux

- Nix (92%):

```sh
nix profile install nixpkgs#tun2proxy
```

  证据: nixpkgs package indexes: pkgs/by-name/tu/tun2proxy/package.nix from https://api.github.com/repos/NixOS/nixpkgs/git/trees/master?recursive=1

## 软件包事实

- **软件包键:** brew:tun2proxy
- **软件包管理器:** Homebrew
- **版本:** 0.8.3
- **来源摘要:** Tunnel (TUN) interface for SOCKS and HTTP proxies
- **主页:** <https://github.com/tun2proxy/tun2proxy>
- **仓库:** <https://github.com/tun2proxy/tun2proxy>
- **最后更新:** 2026-07-23T03:45:27Z
- **已生成:** 2026-08-03T19:37:03+00:00

## 可执行文件

- tun2proxy-bin (别名)
- udpgw-server (别名)

## 安装行为

- Bottle: 不可用

## 版本和新鲜度

- 页面生成时间: 2026-08-03
- 管理器版本: 0.8.3
## 项目历史与用法

tun2proxy is a Rust networking tool that exposes a tunnel interface for routing traffic through HTTP and SOCKS proxies on Linux, Android, macOS, iOS, and Windows. It sits in the niche between VPN-style TUN devices and ordinary application-level proxy settings.

### 项目历史

The README presents tun2proxy as a cross-platform TUN interface for HTTP and SOCKS proxies, with support for SOCKS4, SOCKS4a, SOCKS5, SOCKS5h, HTTP proxy authentication modes, IPv4, IPv6, UDP handling, virtual DNS, DNS-over-TCP proxying, UdpGW, Android per-app routing metadata, and automated setup.

The project has evolved toward operational deployment rather than only library use. Official documentation covers building Apple XCFrameworks, installing binaries from GitHub releases, installing from source with cargo, verifying release artifacts through GitHub build provenance attestations since v0.2.23, and running tun2proxy as a Docker sidecar for other containers.

### 采用历史

Official installation paths include GitHub release binaries and `cargo install tun2proxy`; the input package facts record Homebrew and Nix packages. That mix is typical for lower-level networking tools: source builds for Rust users, binary releases for operators, and package-manager formulas for workstation or server bootstrap.

The README's Docker and Docker Compose examples show adoption beyond interactive CLI use. The documented pattern is to run tun2proxy with NET_ADMIN and /dev/net/tun, then share the resulting network namespace with another container, similar to a sidecar proxy pattern.

### 使用方式

Users provide a proxy URL with `--proxy`, optionally create or name a TUN interface with `--tun`, use `--setup` to configure routing automatically, and choose DNS handling with `--dns direct`, `--dns over-tcp`, or `--dns virtual`. Manual setup examples route broad IPv4 and optional IPv6 ranges through tun0 while bypassing the proxy server itself to avoid routing loops.

For Android 10+ per-app routing, the README documents embedding protocol, source IP, and source port into the SOCKS5 username field by appending `+info` to the username. For container workflows, tun2proxy can become the network namespace provider for another container.

### 为什么软件包爱好者会关心

tun2proxy is significant to package nerds because it solves a classic mismatch: many programs obey system routes or TUN devices, while many cheap or specialized proxy providers expose only HTTP or SOCKS endpoints. A package-installable tun2proxy lets users turn a proxy URL into something that looks closer to a VPN path.

Its appeal is strongest among users who understand TUN devices, routing tables, DNS leaks, Docker namespaces, Wintun, and SOCKS variants. That makes it a very package-nerd package: obscure in general app catalogs, but useful in reproducible network stacks and privacy, testing, mobile, or proxy-routing setups.

### 时间线

- Current README: Documents cross-platform support for Linux, Android, macOS, iOS, and Windows.
- v0.2.23 and later: README documents GitHub build provenance attestations for release artifacts.
- Current README: Documents Docker and Docker Compose sidecar-style usage.

### Related projects

- Wintun is named by the README as a Windows runtime requirement when installing from cargo.
- SOCKS4, SOCKS4a, SOCKS5, SOCKS5h, HTTP proxies, UdpGW, Docker, and GitHub artifact attestations are part of the documented operational context.
- dnsproxy is mentioned as an optional companion when direct DNS handling needs another TCP-capable resolver.

### 来源

- <https://github.com/tun2proxy/tun2proxy README: project description, supported platforms, proxy protocols, DNS modes, setup, CLI, Docker, installation, attestations.>
- <https://github.com/tun2proxy/tun2proxy/wiki: official additional documentation linked from README.>
- input source_facts.package-manager: Homebrew and Nix package coverage.


## 安全说明

没有找到 tun2proxy 的匹配本地密钥处理 manifest。Nucleus 软件包元数据仍在此发布，以便未来覆盖拥有稳定的软件包 URL。


## 其他软件包管理器记录

- Nix - tun2proxy: normalized package name match | nixpkgs package indexes: pkgs/by-name/tu/tun2proxy/package.nix from https://api.github.com/repos/NixOS/nixpkgs/git/trees/master?recursive=1


## Combined YAML source

View the package source record on GitHub. [combined/tun2proxy.yml](https://github.com/mxcl/pkgdb/blob/main/combined/tun2proxy.yml)


## 来源

- pkg.so package database
- Geiger risk classifier
- curated package history
- pkgdb category and tag curation
- external package-manager database matches
- cross-ecosystem install command graph
