Partout
The easiest way to build cross-platform tunnel apps.
Install / Use
/learn @partout-io/PartoutREADME
Partout
The easiest way to build cross-platform tunnel apps.
Partout is a multilanguage library using Swift and C at its core. It provides VPN functionality through the Network Extension framework on Apple platforms, but it partially works on Android, Linux, and Windows (with Wintun). I'm documenting the long journey of making Partout fully cross-platform in a blog series, where I write about the challenges of Swift on non-Apple targets, and how I'm overcoming them.
Partout is the backbone of Passepartout. The footprint is kept in check on non-Apple platforms by reimplementing a small subset of Swift Foundation in the MiniFoundation targets.
Usage
As per the GPL, the public license is not suitable for the App Store and other closed-source distributions. If you want to use Partout for proprietary or commercial purposes, please obtain a proper license.
SwiftPM
Import the library as a SwiftPM dependency:
dependencies: [
.package(url: "https://github.com/partout-io/partout", branch: "master")
],
targets: [
.target(
name: "MyTarget",
dependencies: ["partout"]
)
]
CMake
Partout can be imported as a CMake project. The exported target is partout.
Requirements
- Swift
- C/C++ build tools
- CMake
- ninja
- Android NDK (optional)
- Swift Android SDK (optional)
These are the requirements for Partout, but additional build tools may be required depending on the vendors build system.
Build
First, fetch all the vendored submodules:
git submodule init
git submodule update --recursive
Then, you will use one of the scripts/build.* variants based on the host platform:
scripts/build.sh(bash)scripts/build.ps1(Windows PowerShell)
The script builds the vendors as static libraries and accepts a few options:
-a: Build everything-config (Debug|Release): The CMake build type-android: Build for Android-l: Build the Partout library (opt-in)-crypto (openssl|native): Pick a crypto subsystem between OpenSSL and Native/MbedTLS (WIP)-wireguard: Enable support for WireGuard (requires Go)
For example, this will build Partout for release with a dependency on OpenSSL:
$ scripts/build.sh -config Release -l -crypto openssl
Sample output:
bin/darwin-arm64/libpartout.a # macOS
bin/linux-aarch64/libpartout.a # Linux
bin/windows-arm64/libpartout.lib # Windows
bin/android-aarch64/libpartout.a # Android
Additionally, libpartout_c must be linked. Partout must be bundled with the shared vendored libraries and the Swift runtime to work.
Building for Android requires access to external SDKs:
$ANDROID_NDK_ROOTto point to your Android NDK installation$SWIFT_ANDROID_SDKto point to your Swift for Android SDK installation (e.g. in~/.swiftpm/swift-sdks)
The CMake configuration is done with the android.toolchain.cmake toolchain. The script runs on macOS, but can be adapted for other platforms with slight tweaks to scripts/build.sh.
Codegen
Partout comes with a code generator that translates Swift data entities to a formal OpenAPI specification for non-Swift consumers.
swift run partout-codegen --manifest scripts/manifest.yaml
partout-codegen uses swift-syntax to build an intermediate representation (IR) of the Swift data entities, then proceeds to map it to the OpenAPI format. openapi-generator can eventually be used to generate the Partout data models for other languages.
Demo
Xcode
There is an Xcode Demo in the Examples directory. Edit Demo/Config.xcconfig with your developer details. You must comply with all the capabilities and entitlements in the main app and the tunnel extension target.
Put your configuration files into Demo/App/Files with these names:
- OpenVPN configuration:
test-sample.ovpn - OpenVPN credentials (in two lines):
test-sample.txt - WireGuard configuration:
test-sample.wg
Open Demo.xcodeproj and run the PartoutDemo target.
License
Copyright (c) 2026 Davide De Rosa. All rights reserved.
The library is licensed under the GPLv3. The MiniFoundation targets are MIT-licensed.
Contributing
By contributing to this project you are agreeing to the terms stated in the Contributor License Agreement (CLA). For more details please see CONTRIBUTING.
Credits
Libraries:
Special contributors:
- Tejas Mehta for the implementation of the OpenVPN XOR patch
OpenSSL
This product includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit (http://www.openssl.org/)
OpenVPN
© Copyright 2026 OpenVPN | OpenVPN is a registered trademark of OpenVPN, Inc.
WireGuard
© Copyright 2015-2026 Jason A. Donenfeld. All Rights Reserved. "WireGuard" and the "WireGuard" logo are registered trademarks of Jason A. Donenfeld.
Contacts
Twitter: @keeshux
Website: partout.io
Related Skills
node-connect
349.0kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
109.4kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
349.0kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
349.0kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
