TCP Viewer 是一款 macOS 数据包查看器,支持实时抓包和捕获文件。它使用 AppKit 构建主应用,系统 libpcap 实现抓包,并集成 Wireshark 库进行深层数据包解析。
brew install cmake ninja meson pkg-config autoconf automake libtool
使用子模块克隆仓库并引导固定的 Wireshark 依赖:
git clone --recurse-submodules <repo-url>
cd TCPViewer
cp Config/TCPViewer.local.xcconfig.example Config/TCPViewer.local.xcconfig
./scripts/bootstrap-wireshark.sh
如果已经克隆但未包含子模块:
git submodule update --init --recursive
./scripts/bootstrap-wireshark.sh
scripts/bootstrap-wireshark.sh 首先运行
scripts/bootstrap-wireshark-deps.sh,该脚本将 Wireshark 绑定的运行时库从源码构建到 Vendor/.install/wireshark-deps 目录,部署目标为 macOS 15.0。
Homebrew 仅用于构建工具;发布包不得从 /opt/homebrew 或 /usr/local 复制 Homebrew bottle 动态库。
将本地签名、应用更新、Sparkle、Sentry 和发布值保留在 Git 之外。使用忽略的本地文件,如 Config/TCPViewer.local.xcconfig、.env、Shell 环境变量或钥匙串支持的工具。
在 Xcode 中:
TCPViewer.xcodeproj。TCPViewer scheme。My Mac。命令行构建:
xcodebuild -project TCPViewer.xcodeproj -scheme TCPViewer build
如果 Xcode 要求签名,请为 TCPViewer 和 PcapPlusPlusCore 选择一个开发团队。
xcodebuild test \
-project TCPViewer.xcodeproj \
-scheme TCPViewer \
-destination 'platform=macOS'
TCP Viewer 的发布版本通过发布脚本构建、公证、为 Sparkle 签名、上传到 Cloudflare R2,并可选择发布到发布后端。
首次发布设置:
npm install
bundle install
gh auth login
从 .env.example 创建本地 .env 文件,并填写所需的发布值。切勿提交真实密钥。将 .env 中的注释保留为 # 注释,因为 sentry-cli 在加载文件时不接受 // 注释。
对于生产发布,在 ReleaseNote.json 中添加匹配的条目,然后运行:
npm run release
根据提示选择 beta 或 production。生产发布还会创建 Sparkle 应用更新源、推送 v<版本> 标签并发布 GitHub 发布。工件将写入:
~/Desktop/tcpviewer-production/
TCP Viewer 采用 GPL-2.0-or-later 许可证。这与应用集成的 Wireshark 库一致:libwireshark、libwiretap 和 libwsutil 都是受 GPL 保护的 Wireshark 库。
完整 GPL 文本见 COPYING,第三方声明见 THIRD_PARTY_NOTICES.md,二进制发布版源代码获取条款见 SOURCE_CODE_OFFER.md。
TCP Viewer 基于 Wireshark 进行数据包解析,并基于 HexFiend 实现内嵌十六进制查看器。详情请参见 THIRD_PARTY_NOTICES.md。