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.
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.
Import the library as a SwiftPM dependency:
dependencies: [
.package(url: "https://github.com/partout-io/partout", branch: "master")
],
targets: [
.target(
name: "MyTarget",
dependencies: ["partout"]
)
]The C ABI is a work in progress.
- 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.
First, fetch all the vendored submodules:
git submodule init
git submodule update --recursiveThen, 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 opensslSample output:
bin/<platform-arch>/partout.h # The Partout ABI
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.
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.
Copyright (c) 2025 Davide De Rosa. All rights reserved.
The library is licensed under the GPLv3. The MiniFoundation targets are MIT-licensed.
By contributing to this project you are agreeing to the terms stated in the Contributor License Agreement (CLA). For more details please see CONTRIBUTING.
Libraries:
Special contributors:
- Tejas Mehta for the implementation of the OpenVPN XOR patch
This product includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit (http://www.openssl.org/)
© Copyright 2025 OpenVPN | OpenVPN is a registered trademark of OpenVPN, Inc.
© Copyright 2015-2025 Jason A. Donenfeld. All Rights Reserved. "WireGuard" and the "WireGuard" logo are registered trademarks of Jason A. Donenfeld.
Twitter: @keeshux
Website: partout.io