aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorMax Liu <maliu@mozilla.com>2019-10-08 17:12:46 +0800
committerRoger Chuang <lchuang@mozilla.com>2019-11-26 19:12:39 +0800
commit6b4c015b308a2a48ecae244296f6ca8e2394950b (patch)
tree76ed01356d2fc1781751b1d4a0e0077db9713df2
parentVersion bump (diff)
downloadwireguard-android-6b4c015b308a2a48ecae244296f6ca8e2394950b.tar.xz
wireguard-android-6b4c015b308a2a48ecae244296f6ca8e2394950b.zip
Add libwg gradle module
Signed-off-by: Roger Chuang <lchuang@mozilla.com>
-rw-r--r--libwg/.gitignore1
-rw-r--r--libwg/build.gradle36
-rw-r--r--libwg/consumer-rules.pro0
-rw-r--r--libwg/proguard-rules.pro21
-rw-r--r--libwg/src/main/AndroidManifest.xml7
-rw-r--r--libwg/src/main/java/com/wireguard/android/backend/BackendNative.kt24
6 files changed, 89 insertions, 0 deletions
diff --git a/libwg/.gitignore b/libwg/.gitignore
new file mode 100644
index 00000000..796b96d1
--- /dev/null
+++ b/libwg/.gitignore
@@ -0,0 +1 @@
+/build
diff --git a/libwg/build.gradle b/libwg/build.gradle
new file mode 100644
index 00000000..3bd71511
--- /dev/null
+++ b/libwg/build.gradle
@@ -0,0 +1,36 @@
+/*
+ * Copyright © 2015-2019 WireGuard LLC. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+apply plugin: 'com.android.library'
+apply plugin: 'kotlin-android'
+apply plugin: 'kotlin-android-extensions'
+
+android {
+ compileSdkVersion 29
+ buildToolsVersion "29.0.2"
+
+
+ defaultConfig {
+ minSdkVersion 21
+ targetSdkVersion 29
+ consumerProguardFiles 'consumer-rules.pro'
+ }
+
+ buildTypes {
+ debug {
+ }
+ release {
+ }
+ }
+ externalNativeBuild {
+ cmake {
+ path rootDir.path + '/app/tools/CMakeLists.txt'
+ }
+ }
+}
+
+dependencies {
+
+}
diff --git a/libwg/consumer-rules.pro b/libwg/consumer-rules.pro
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/libwg/consumer-rules.pro
diff --git a/libwg/proguard-rules.pro b/libwg/proguard-rules.pro
new file mode 100644
index 00000000..f1b42451
--- /dev/null
+++ b/libwg/proguard-rules.pro
@@ -0,0 +1,21 @@
+# Add project specific ProGuard rules here.
+# You can control the set of applied configuration files using the
+# proguardFiles setting in build.gradle.
+#
+# For more details, see
+# http://developer.android.com/guide/developing/tools/proguard.html
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+# public *;
+#}
+
+# Uncomment this to preserve the line number information for
+# debugging stack traces.
+#-keepattributes SourceFile,LineNumberTable
+
+# If you keep the line number information, uncomment this to
+# hide the original source file name.
+#-renamesourcefileattribute SourceFile
diff --git a/libwg/src/main/AndroidManifest.xml b/libwg/src/main/AndroidManifest.xml
new file mode 100644
index 00000000..4b4136ce
--- /dev/null
+++ b/libwg/src/main/AndroidManifest.xml
@@ -0,0 +1,7 @@
+<!--
+ ~ Copyright © 2015-2019 WireGuard LLC. All Rights Reserved.
+ ~ SPDX-License-Identifier: Apache-2.0
+ -->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.wireguard.android.backend" />
diff --git a/libwg/src/main/java/com/wireguard/android/backend/BackendNative.kt b/libwg/src/main/java/com/wireguard/android/backend/BackendNative.kt
new file mode 100644
index 00000000..59e9a653
--- /dev/null
+++ b/libwg/src/main/java/com/wireguard/android/backend/BackendNative.kt
@@ -0,0 +1,24 @@
+/*
+ * Copyright © 2019 WireGuard LLC. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+package com.wireguard.android.backend
+
+public open class BackendNative {
+
+ public external fun wgGetSocketV4(handle: Int): Int
+
+ public external fun wgGetSocketV6(handle: Int): Int
+
+ public external fun wgTurnOff(handle: Int)
+
+ public external fun wgTurnOn(ifName: String, tunFd: Int, settings: String): Int
+
+ public external fun wgVersion(): String
+
+ init {
+ System.loadLibrary("wg-go")
+ }
+
+} \ No newline at end of file