Outline SDK (Alpha)

⚠️ Warning: This code is in early stages and is not guaranteed to be stable. If you are
interested in integrating with it, we'd love your feedback.
The Outline SDK allows you to:
- Create tools to protect against network-level interference
- Add network-level interference protection to existing apps, such as content or communication apps
Advantages
| Multi-Platform |
Proven Technology |
Composable |
| Supports Android, iOS, Windows, macOS and Linux. |
Field-tested in the Outline Client and Server, helping millions to access the internet under harsh conditions. |
Designed for modularity and reuse, allowing you to craft custom transports. |
Integration Methods
Choose from one of the following methods to integrate the Outline SDK into your project:
- Generated Mobile Library: For Android, iOS, and macOS apps. Uses
gomobile bind for generating Java and Objective-C bindings.
- Side Service: For desktop and Android apps. Runs a standalone Go binary that your application communicates with (not available on iOS due to subprocess limitations).
- Go Library: Directly import the SDK into your Go application. API Reference.
- Generated C Library: Generate C bindings using
go build.
The Outline Client uses a generated mobile library on Android, iOS and macOS (based on Cordova) and a side service on Windows and Linux (based on Electron).
Below we provide more details on the integration approaches.
Generated Mobile Library
To integrate the SDK into a mobile app, follow these steps:
- Create a Go library: Create a Go package that wraps the SDK functionalities you need.
- Generate mobile library: Use
gomobile bind to generate Android Archives (AAR) and Apple Frameworks with Java and Objective-C bindings.
- Integrate into your app: Add the generated library to your app. For more details, see Go Mobile's SDK applications and generating bindings.
Note: You must use gomobile bind on a package you create, not directly on the SDK packages.
Side Service
To integrate the SDK as a side service, follow these steps:
- Define IPC mechanism: Choose an inter-process communication (IPC) mechanism (e.g., sockets, standard I/O).
- Build the service: Create a Go binary that includes the server-side of the IPC and used the SDK.
- Bundle the service: Include the Go binary in your application bundle.
- Start the service: Launch the Go binary as a subprocess from your application.
- Service Calls: Add code to your app for communication with the service.
Go Library
To integrate the Outline SDK as a Go library, you can directly import it into your Go application. See the API Reference for what's available.
This approach is suitable for both command-line and GUI-based applications. You can build GUI-based applications in Go with frameworks like Wails, Fyne.io, Qt for Go, or Go Mobile app.
For examples, see x/examples.
Generated C Library
For applications that require C bindings. This approach is similar to the Generated Mobile Library approach, where you need to first create a Go library to generate bindings for.
Steps:
- Create a Go library: Create a Go package that wraps the SDK functionalities you need. Functions to be exported must be marked with
//export, as per the cgo documentation.
- Generate C library: Use
go build with the appropriate -buildmode flag. Anternatively, you can use SWIG.
- Integrate into your app: Add the generated C library to your application, according to your build system.
Tentative Roadmap
The launch will have two milestones: Alpha and Beta. We are currently in Alpha. Most of the code is not new. It's the same code that is currently being used by the production Outline Client and Server. The SDK repackages code from outline-ss-server and outline-go-tun2socks in a way that is easier to reuse and extend.
Alpha
The goal of the Alpha release is to make it available to potential developers early, so they can provide feedback on the SDK and help shape the interfaces, processes and tools.
Alpha features:
Beta
The goal of the Beta release is to make the SDK available for broader consumption, once we no longer expect major changes to the APIs and we have all supporting resources in place (website, documentation, examples, and so on).
Beta features: