Private Internet Access is the world's leading consumer VPN service. At Private Internet Access we believe in unfettered access for all, and as a firm supporter of the open source ecosystem we have made the decision to open source our VPN clients. For more information about the PIA service, please visit our website privateinternetaccess.com or check out the Wiki.
With this library, clients from iOS and Android can communicate easily with the Private Internet Access region's services.
- Git (latest)
- Xcode (latest)
- Android Studio (latest)
- Gradle (latest)
- ADB installed
- NDK (latest)
- Android 4.1+
Using the terminal:
git clone https://github.com/pia-foss/mobile-common-regions.git *folder-name*
type in what folder you want to put in without the **
Once the project is cloned, you can build the binaries by running the tasks ./gradlew bundleDebugAar
or ./gradlew bundleReleaseAar
for Android. And, ./gradlew assembleRegionsDebugXCFramework
or ./gradlew assembleRegionsReleaseXCFramework
for iOS. You can find the binaries at [PROJECT_DIR]/regions/build/outputs/aar
and [PROJECT_DIR]/regions/build/XCFrameworks
accordingly.
To use this project in Android, you can run the task ./gradlew publishAndroidReleasePublicationToMavenLocal
. This will publish the package to your maven local (Make sure to have included mavenLocal()
as part of your gradle repositories). Once successful, you can set the dependency as per any other package, e.g.:
implementation("com.kape.android:regions:[version_number]")
where [version_number]
is the version as set in regions/build.gradle.kts
.
To use this project in iOS, once you have built regions.xcframework
. You can go to your project target. Build Phases. Link Binary With Libraries. (or alternatively drag the file there and skip the rest) Click the +
. Add Other. Add Files. And look for regions.xcframework
.
The library is formed by two layers. The common layer. Containing the business logic for all platforms. And, the bridging layer. Containing the platform specific logic being injected into the common layer.
Code structure via packages:
commonMain
- Common business logic.androidMain
- Android's bridging layer, providing the platform specific dependencies.iosMain
- iOS's bridging layer, providing the platform specific dependencies.
RegionsBuilder
- Public builder class responsible for creating an instance of an object conforming to theRegionsAPI
interface for the client side.RegionsCommonBuilder
- Internal builder class responsible for creating an instance of an object conforming to theRegionsAPI
interface and injecting the platform specific dependencies.RegionsAPI
- Public interface defining the API to be offered by the library to the clients.RegionsResponse
- Public data class representing the serialized data from our regions service.MessageVerificationHandler
- Handler conforming to the interfaceMessageVerificator
and providing the defined capabilities to the common logic.PingRequestHandler
- Handler conforming to the interfacePingRequest
and providing the defined capabilities to the common logic.
By contributing to this project you are agreeing to the terms stated in the Contributor License Agreement (CLA) here.
For more details please see CONTRIBUTING.
Issues and Pull Requests should use these templates: ISSUE and PULL REQUEST.
This project is licensed under the MIT (Expat) license, which can be found here.
- Ktor - © 2020 (http://ktor.io)