-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
96 additions
and
98 deletions.
There are no files selected for viewing
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,96 @@ | ||
# wg-easy-wrapper | ||
wg easy wrapper | ||
## WG-EASY-WRAPPER | ||
|
||
An API wrapper for [wg-easy](https://github.com/WeeJeWel/wg-easy/) written in Java by @megoRU | ||
|
||
### Maven | ||
|
||
https://jitpack.io/#megoRU/wg-easy-wrapper | ||
|
||
```xml | ||
|
||
<repositories> | ||
<repository> | ||
<id>jitpack.io</id> | ||
<url>https://jitpack.io</url> | ||
</repository> | ||
</repositories> | ||
|
||
<dependency> | ||
<groupId>com.github.megoRU</groupId> | ||
<artifactId>wg-easy-wrapper</artifactId> | ||
<version>v1.0</version> | ||
</dependency> | ||
``` | ||
|
||
## Examples | ||
|
||
### Get all Clients (peers) | ||
|
||
```java | ||
public class Main { | ||
public static void main(String[] args) { | ||
WgEasyAPI api = new WgEasyAPI.Builder() | ||
.password("password") | ||
.domain("vpn.megoru.ru") | ||
.build(); | ||
try { | ||
Clients[] clients = api.getClients(); | ||
|
||
for (Clients client : clients) { | ||
System.out.println(client.getId()); //139987fc-266a-45bb-b3c4-3e1d8d2e180c | ||
// ... | ||
} | ||
} catch (UnsuccessfulHttpException e) { | ||
System.out.println(e.getMessage()); | ||
} | ||
} | ||
} | ||
``` | ||
|
||
### Disable Client (peer) | ||
|
||
```java | ||
public class Main { | ||
public static void main(String[] args) { | ||
WgEasyAPI api = new WgEasyAPI.Builder() | ||
.password("password") | ||
.domain("vpn.megoru.ru") | ||
.build(); | ||
try { | ||
Status status = api.disableClient("139987fc-266a-45bb-b3c4-3e1d8d2e180c"); | ||
} catch (UnsuccessfulHttpException e) { | ||
System.out.println(e.getMessage()); | ||
} | ||
} | ||
} | ||
``` | ||
|
||
### Create Client (peer) | ||
|
||
```java | ||
public class Main { | ||
public static void main(String[] args) { | ||
WgEasyAPI api = new WgEasyAPI.Builder() | ||
.password("password") | ||
.domain("vpn.megoru.ru") | ||
.build(); | ||
try { | ||
Create create = api.createClient("mego"); | ||
System.out.println(create.getCreatedAt()); //2023-01-12T18:20:12 | ||
} catch (UnsuccessfulHttpException e) { | ||
System.out.println(e.getMessage()); | ||
} | ||
} | ||
} | ||
``` | ||
|
||
## Dependencies | ||
|
||
1. [Gson](https://github.com/google/gson) | ||
2. [Apache HttpClient](https://github.com/apache/httpcomponents-client) | ||
3. [JSON-java](https://github.com/stleary/JSON-java) | ||
4. [okhttp](https://github.com/square/okhttp) | ||
|
||
## Links | ||
|
||
* [Contact me](https://megoru.ru) |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file was deleted.
Oops, something went wrong.