Skip to content

Commit efb3ed2

Browse files
Merge pull request #29 from codewithtamim/chore/update-lib
Update Library
2 parents ccd28e8 + 34841f0 commit efb3ed2

File tree

17 files changed

+99
-164
lines changed

17 files changed

+99
-164
lines changed

.idea/AndroidProjectSystem.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 27 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,26 @@
11
# WireGuard Android Library
2-
![Kotlin](https://img.shields.io/badge/Kotlin-7F52FF?style=for-the-badge&logo=kotlin&logoColor=white)
3-
![Downloads](https://img.shields.io/github/downloads/CodeWithTamim/WGAndroidLib/total?style=for-the-badge&logo=download)
4-
![Version](https://img.shields.io/badge/Version-1.1.0-blue?style=for-the-badge)
52

6-
Simplify the integration of **WireGuard VPN** in your Android applications with this library. This library provides a clean API to manage VPN connections, handle configurations, and monitor tunnel states.
3+
A simple Android library for integrating WireGuard VPN functionality into your applications. Provides clean API for managing VPN connections, handling configurations, and monitoring tunnel states.
74

8-
## 👨‍💻 Professional Services
9-
10-
I'm available for professional work! Whether you need help with:
11-
- Custom Android app development
12-
- Library development and maintenance
13-
- Code review and optimization
14-
- Technical consulting
15-
- Or any other Android-related work
16-
17-
Feel free to reach out:
18-
- 📧 Email: [[email protected]](mailto:[email protected])
19-
- 💬 Telegram: [@codewithtamim](https://t.me/codewithtamim)
20-
- 🌐 GitHub: [@CodeWithTamim](https://github.com/CodeWithTamim)
21-
22-
---
235

246
## Features
257

26-
- **Lightweight & Fast**: Minimal overhead with seamless integration
27-
- **Comprehensive API**: Start, stop, and monitor VPN connections effortlessly
28-
- **State Management**: Robust state management with proper error handling
29-
- **Traffic Statistics**: Real-time monitoring of upload and download speeds
30-
- **Notification Support**: Built-in notification system for VPN status
31-
- **Permission Handling**: Easy permission management for VPN and notifications
32-
- **Builder Pattern**: Clean configuration using builder pattern
33-
- **Input Validation**: Comprehensive validation of configuration parameters
34-
- **Error Handling**: Proper error handling and logging throughout the library
35-
- **Cross-Language Support**: Examples provided in both Kotlin and Java
36-
37-
---
8+
- Lightweight and fast with minimal overhead
9+
- Comprehensive API for VPN connection management
10+
- Robust state management with proper error handling
11+
- Real-time traffic statistics monitoring
12+
- Built-in notification system for VPN status
13+
- Easy permission management for VPN and notifications
14+
- Clean configuration using builder pattern
15+
- Comprehensive input validation
16+
- Proper error handling and logging
17+
- Examples provided in both Kotlin and Java
3818

3919
## Installation
4020

4121
### Option 1: Using JitPack Dependency
4222

43-
This library is available via [JitPack](https://jitpack.io). Add the repository and dependency to your project:
23+
Add the repository and dependency to your project:
4424

4525
#### Gradle Groovy
4626
```gradle
@@ -52,7 +32,7 @@ allprojects {
5232
}
5333
5434
dependencies {
55-
implementation 'com.github.CodeWithTamim:WGAndroidLib:1.1.0'
35+
implementation 'com.github.thebytearray:WGAndroidLib:1.1.0'
5636
}
5737
```
5838

@@ -64,25 +44,25 @@ repositories {
6444
}
6545

6646
dependencies {
67-
implementation("com.github.CodeWithTamim:WGAndroidLib:1.1.0")
47+
implementation("com.github.thebytearray:WGAndroidLib:1.1.0")
6848
}
6949
```
7050

7151
### Option 2: Importing the WireGuard Module
7252

73-
For advanced users who want more control or customization, you can directly include the WireGuard module in your project using Android Studio.
53+
For advanced users who want more control, you can directly include the WireGuard module in your project.
7454

7555
1. Clone the repository:
7656
```bash
77-
git clone https://github.com/CodeWithTamim/WGAndroidLib.git
57+
git clone https://github.com/thebytearray/WGAndroidLib.git
7858
```
7959

80-
2. In Android Studio, follow these steps:
81-
- Go to **File** > **New** > **Import Module**.
82-
- Select the `wireguard` module folder from the cloned repository.
83-
- Click **Finish** to add the module to your project.
60+
2. In Android Studio:
61+
- Go to File > New > Import Module
62+
- Select the `wireguard` module folder from the cloned repository
63+
- Click Finish to add the module to your project
8464

85-
3. Add the module as a dependency in your app's `build.gradle` (Groovy) or `build.gradle.kts` (Kotlin DSL):
65+
3. Add the module as a dependency:
8666

8767
#### Gradle Groovy
8868
```gradle
@@ -98,13 +78,11 @@ dependencies {
9878
}
9979
```
10080

101-
---
102-
10381
## Setup
10482

10583
### 1. Configure the Application Class
10684

107-
Create an `Application` class to configure a notification channel for VPN usage:
85+
Create an Application class to configure notification channel for VPN usage:
10886

10987
#### Kotlin Example
11088
```kotlin
@@ -153,7 +131,7 @@ public class TunnelApplication extends Application {
153131

154132
### 2. Add Required Permissions and Services
155133

156-
Add these permissions and services to your `AndroidManifest.xml` file:
134+
Add these permissions and services to your AndroidManifest.xml:
157135

158136
```xml
159137
<!-- Permissions -->
@@ -165,7 +143,7 @@ Add these permissions and services to your `AndroidManifest.xml` file:
165143

166144
<!-- Services -->
167145
<service
168-
android:name="com.nasahacker.wireguard.service.TunnelService"
146+
android:name="org.thebytearray.wireguard.service.TunnelService"
169147
android:exported="true"
170148
android:foregroundServiceType="specialUse"
171149
android:permission="android.permission.FOREGROUND_SERVICE" />
@@ -279,31 +257,23 @@ public class MainActivity extends AppCompatActivity {
279257
}
280258
```
281259

282-
---
283-
284260
## Error Handling
285261

286-
The library provides comprehensive error handling and logging. All major operations are wrapped in try-catch blocks and provide detailed error messages. You can monitor the logs using the following tags:
262+
The library provides comprehensive error handling and logging. All major operations are wrapped in try-catch blocks and provide detailed error messages. You can monitor the logs using these tags:
287263

288264
- `ServiceManager`: For service management related logs
289265
- `TunnelService`: For VPN tunnel related logs
290266

291-
---
292-
293267
## Contributing
294268

295269
Contributions are welcome! Please feel free to submit a Pull Request.
296270

297-
---
298-
299271
## License
300272

301-
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
302-
303-
---
273+
This project is licensed under the MIT License - see the LICENSE file for details.
304274

305275
## Author
306276

307277
- **Tamim Hossain**
308278
309-
- GitHub: [@CodeWithTamim](https://github.com/CodeWithTamim)
279+
- GitHub: @thebytearray
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#Fri Nov 15 13:43:12 BDT 2024
1+
#Fri Aug 08 00:48:02 BDT 2025
22
distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
4-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11-bin.zip
4+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip
55
zipStoreBase=GRADLE_USER_HOME
66
zipStorePath=wrapper/dists

wireguard/build.gradle.kts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,17 @@ plugins {
33
alias(libs.plugins.kotlin.android)
44
alias(libs.plugins.maven)
55
}
6+
val sdkVersion = "1.1.1"
7+
val jitpackGroupId = "com.github.thebytearray"
8+
val packageId = "org.thebytearray.wireguard"
69

710
android {
8-
namespace = "com.nasahacker.wireguard"
11+
namespace = packageId
912
compileSdk = 35
1013

1114
defaultConfig {
1215
minSdk = 21
13-
version = "1.1.0"
16+
version = sdkVersion
1417

1518
consumerProguardFiles("consumer-rules.pro")
1619
}
@@ -47,9 +50,9 @@ android {
4750
publishing {
4851
publications {
4952
create("release", MavenPublication::class) {
50-
groupId = "com.github.CodeWithTamim"
53+
groupId = jitpackGroupId
5154
artifactId = "WGAndroidLib"
52-
version = "1.1.0"
55+
version = sdkVersion
5356

5457
afterEvaluate {
5558
from(components["release"])

wireguard/src/androidTest/java/com/nasahacker/wireguard/ExampleInstrumentedTest.kt

Lines changed: 0 additions & 24 deletions
This file was deleted.

wireguard/src/main/AndroidManifest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
33

44
<!--
5-
<application android:name="com.nasahacker.wglib.TunnelApplication">
5+
<application android:name="org.thebytearray.wglib.TunnelApplication">
66
</application>
77
88
-->

wireguard/src/main/java/com/nasahacker/wireguard/extension/_Ext.kt renamed to wireguard/src/main/java/org/thebytearray/wireguard/extension/_Ext.kt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1-
package com.nasahacker.wireguard.extension
1+
package org.thebytearray.wireguard.extension
2+
3+
24

35

46
/**
5-
* CodeWithTamim
7+
* TheByteArray
68
*
79
* @developer Tamim Hossain
8-
10+
911
*/
1012

1113
const val THRESHOLD = 1000L

wireguard/src/main/java/com/nasahacker/wireguard/model/TunnelConfig.kt renamed to wireguard/src/main/java/org/thebytearray/wireguard/model/TunnelConfig.kt

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
1-
package com.nasahacker.wireguard.model
1+
package org.thebytearray.wireguard.model
22

33
import com.google.gson.annotations.SerializedName
44
import java.io.Serializable
5-
import java.net.InetAddress
65
import java.util.regex.Pattern
7-
86
/**
9-
* Configuration class for WireGuard tunnel.
10-
* This class represents the configuration needed to establish a WireGuard VPN connection.
7+
* TheByteArray
118
*
12-
* @property interfaceField The interface configuration for the tunnel
13-
* @property peer The peer configuration for the tunnel
9+
* @developer Tamim Hossain
10+
1411
*/
1512
data class TunnelConfig(
1613
@SerializedName("interface")

wireguard/src/main/java/com/nasahacker/wireguard/model/TunnelState.kt renamed to wireguard/src/main/java/org/thebytearray/wireguard/model/TunnelState.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
package com.nasahacker.wireguard.model
1+
package org.thebytearray.wireguard.model
22
/**
3-
* CodeWithTamim
3+
* TheByteArray
44
*
55
* @developer Tamim Hossain
6-
6+
77
*/
88
enum class TunnelState {
99
CONNECTED,

wireguard/src/main/java/com/nasahacker/wireguard/model/WgTunnel.kt renamed to wireguard/src/main/java/org/thebytearray/wireguard/model/WgTunnel.kt

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
1-
package com.nasahacker.wireguard.model
1+
package org.thebytearray.wireguard.model
2+
23

3-
import com.nasahacker.wireguard.util.Constants
44
import com.wireguard.android.backend.Tunnel
5+
import org.thebytearray.wireguard.util.Constants
56

67
/**
7-
* CodeWithTamim
8+
* TheByteArray
89
*
910
* @developer Tamim Hossain
10-
11+
1112
*/
1213
class WgTunnel : Tunnel
1314
{

0 commit comments

Comments
 (0)