# 使用 Homebrew, MacPorts, Nix 安装 trojan-go

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

## 安装

```sh
sudo av install brew:trojan-go
```

其他安装命令:

### macOS

- Homebrew (100%):

```sh
brew install trojan-go
```

  证据: local Homebrew formula metadata

- MacPorts (94%):

```sh
sudo port install trojan-go
```

  证据: MacPorts ports tree: net/trojan-go/Portfile from https://api.github.com/repos/macports/macports-ports/git/trees/master?recursive=1

### Linux

- Nix (92%):

```sh
nix profile install nixpkgs#trojan-go
```

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

## 软件包事实

- **软件包键:** brew:trojan-go
- **软件包管理器:** Homebrew
- **软件包管理器页面:** <https://formulae.brew.sh/formula/trojan-go>
- **版本:** 0.10.6
- **来源摘要:** Trojan proxy in Go
- **主页:** <https://p4gefau1t.github.io/trojan-go/>
- **仓库:** <https://github.com/p4gefau1t/trojan-go>
- **上游文档:** <https://p4gefau1t.github.io/trojan-go/>
- **许可证:** GPL-3.0-only
- **源码归档:** <https://github.com/p4gefau1t/trojan-go.git>
- **最后更新:** 2026-07-26T00:51:27+02:00
- **已生成:** 2026-08-04T22:13:35+00:00

## 可执行文件

- trojan-go (cli)
- trojan-go (别名)

## 构建依赖

- go

## 安装行为

- post-install 钩子: 未定义
- 服务: declared
- 注意事项: An example config is installed to $HOMEBREW_PREFIX/etc/trojan-go/config.json
- Bottle: 可用 于 arm64_linux, arm64_sequoia, arm64_sonoma, arm64_tahoe, sonoma, x86_64_linux

## 版本和新鲜度

- 页面生成时间: 2026-08-04
- 管理器版本: 0.10.6
- 管理器更新时间: 2026-07-26
- 本地数据: OK
- 上游仓库: https://github.com/p4gefau1t/trojan-go
- 信息: No cached GitHub release or tag data was available.
## 项目历史与用法

Trojan-Go is a Go implementation of the Trojan proxy protocol. The official README describes it as compatible with the original Trojan protocol and configuration file format, while adding performance, routing, WebSocket, AEAD, plugin, API, and YAML configuration features.

### 项目历史

Trojan-Go's history is best understood as an extension-oriented reimplementation rather than a wholly separate protocol. Its README emphasizes compatibility with the original Trojan feature set, including TLS tunneling, UDP proxying, transparent proxy modes, detection-resistance mechanisms, MySQL persistence, user authentication, traffic statistics, and quota controls.

The Go implementation then adds features aimed at real-world deployment friction: a simplified mode, automatic SOCKS5/HTTP proxy adaptation, TProxy support, smux multiplexing, custom routing, WebSocket-over-TLS for CDN transit, TLS fingerprint handling, gRPC APIs, pluggable transports, Shadowsocks AEAD-style secondary encryption, and YAML configuration.

### 采用历史

The official README points users to precompiled release binaries, Docker deployment, and a Telegram feedback group. It also names graphical clients that support Trojan-Go extensions, including Qv2ray and Igniter-Go, while noting compatibility with original Trojan clients when extension-only features are not used.

This adoption history is concentrated in the proxy/censorship-circumvention tooling niche rather than general networking. Package managers such as Homebrew, MacPorts, and Nix make the daemon easier to install on developer machines and small servers, while the README's cross-compilation examples show interest in routers, Raspberry Pi, and other constrained targets.

### 使用方式

The README documents quick server and client startup flags, conventional config-file operation with `trojan-go -config config.json`, URL-based client startup, and Docker deployment with host-mounted configuration. It shows separate server and client examples and provides both JSON and YAML client/server config examples.

Package users typically install the binary, write a server or client config, and run it as a local proxy, transparent proxy, relay, or daemon. The package is useful to operators who want the Trojan ecosystem with a single Go binary and extra transports such as WebSocket over TLS.

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

Trojan-Go is package-nerd-significant because it is a protocol-compatible reimplementation that exposes many deployment choices through one binary. It is also an example of proxy tooling where packaging, release binaries, Docker images, and cross-compilation all matter because users deploy the same tool on desktops, servers, routers, and small devices.

Its Homebrew formula is especially relevant for macOS users who want to test or operate proxy tooling without manually downloading release archives from GitHub.

### 时间线

- Original Trojan compatibility: README documents compatibility with the original Trojan protocol and config format.
- Extension phase: README documents multiplexing, routing, WebSocket-over-TLS, AEAD, gRPC API, transport plugins, and YAML config.
- Current README: precompiled binaries, Docker deployment, quick-start flags, and config-file operation are documented as primary usage paths.

### Related projects

- Trojan, Qv2ray, Igniter-Go, Shadowsocks AEAD, smux, v2ray-plugin

### 来源

- <https://github.com/p4gefau1t/trojan-go#readme>
- <https://p4gefau1t.github.io/trojan-go>


## 安全说明

formula declares a Homebrew service.

- **Geiger 风险:** orange / 中
- formula declares a Homebrew service


## Configuration and credential file locations

These source-backed paths show where this package keeps local settings or durable credentials. Automic Vault can use them as review targets for secret scanning, migration, and command approval.


## Configuration files

- Unix: config.json, server.json, client.json, client.yaml
## 源数据库详情

- **Source Database:** Homebrew formula API
- **Tap:** homebrew/core
- **Full Name:** trojan-go
- **Version Scheme:** 0
- **Revision:** 0
- **Head Version:** HEAD
- **Bottle Stable Root URL:** <https://ghcr.io/v2/homebrew/core>
- **Deprecated:** no
- **Disabled:** no
- **Keg Only:** no
- **URL Keys:** head, stable

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

- Nix - trojan-go: normalized package name match | nixpkgs package indexes: pkgs/by-name/tr/trojan-go/package.nix from https://api.github.com/repos/NixOS/nixpkgs/git/trees/master?recursive=1
- MacPorts - trojan-go: normalized package name match | MacPorts ports tree: net/trojan-go/Portfile from https://api.github.com/repos/macports/macports-ports/git/trees/master?recursive=1


## 相关链接

- [Source-control packages](https://pkg.so/zh-hans/source-control-tools/) - Belongs to a source-control command family.
- [Secret-risk packages](https://pkg.so/zh-hans/secret-risk-packages/) - Has protected-tool coverage, approval-gate, or non-low Geiger security signals.
- [Terminal utility packages](https://pkg.so/zh-hans/terminal-utilities/) - Matched terminal and command-line workflow metadata.
- [Language runtime packages](https://pkg.so/zh-hans/language-runtime-packages/) - Matched language runtime, compiler, or interpreter metadata.
- [go](https://pkg.so/zh-hans/brew/go/) - Build dependency declared by Homebrew.
- [v2ray](https://pkg.so/zh-hans/brew/v2ray/) - Shares pkgdb curated category or tags: cli, networking, proxy, tunneling.
- [mihomo](https://pkg.so/zh-hans/brew/mihomo/) - Shares pkgdb curated category or tags: cli, go, networking, proxy.
- [gost](https://pkg.so/zh-hans/brew/gost/) - Shares pkgdb curated category or tags: cli, go, networking, proxy.
- [connect](https://pkg.so/zh-hans/brew/connect/) - Shares pkgdb curated category or tags: cli, networking, proxy, tunneling.
- [ptunnel](https://pkg.so/zh-hans/brew/ptunnel/) - Shares pkgdb curated category or tags: cli, networking, proxy, tunneling.
- [pwnat](https://pkg.so/zh-hans/brew/pwnat/) - Shares pkgdb curated category or tags: cli, networking, proxy, tunneling.
- [sshuttle](https://pkg.so/zh-hans/brew/sshuttle/) - Shares pkgdb curated category or tags: cli, networking, proxy, tunneling.
- [sing-box](https://pkg.so/zh-hans/brew/sing-box/) - Shares pkgdb curated category or tags: cli, networking, proxy.

## Combined YAML source

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


## 来源

- pkg.so package database
- Geiger risk classifier
- package-page enrichment
- curated configuration and credential file locations
- curated package history
- package version freshness
- pkgdb category and tag curation
- package relationship graph
- external package-manager database matches
- cross-ecosystem install command graph
