Skip to content
This repository was archived by the owner on Nov 1, 2025. It is now read-only.

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

78 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WgEasyManager

GitHub repo size GitHub GitHub release (latest by date including pre-releases) GitHub last commit Nuget GitHub issues Twitter Follow

.NET Library for working with WireGuard keys by wg-easy API

This Library is helpful for Telegram bots💪🏻

Installiation

Type this command in project's folder:

dotnet add package WgEasyManager

Quick start

  1. Get URL of your server with port
  2. Get password for access
  3. Initialize WgEasyClient:
private static WgEasyClient client = new("0.0.0.0:12345", "sup3rSecr3tPassw0rd", true);
//if your server hasn't SSL - set false
  1. Login to server:
static async Task Main(){
    await client.LoginToServerIfNeeded();
    //some code...
}

After Initialize in folder "wg-sessions" you can see "ip/port.wgmanager". It's cookies for access to your server.

Editing Keys

1. Get Keys

For getting keys use method .GetKeys()

var keys = client.GetKeys();
//returns List<WireGuardKey>

2. Create new key

Use method .CreateKey() for key creating

Parameters:

  • name - name of key
client.CreateKey("Lance's key");
//return key info in object 'WireGuardKey'

Also you can delete key with method DeleteKey() with parameter clientId

3. Block Key

Use method .BlockKey() for key baning

Parameters:

  • clientId - Client ID in wg-easy
client.DeleteKey("xxxx-xxxx-xxxx-xxxx");
// Key id you can get in object "WireGuardKey"

Also you can unblock key with method UnbanKey() with parameter clientId

4. Rename key

Use method .RenameKey() for updating key's name

Parameters:

  • clientId - client Id
  • name - new name for this key
client.RenameKey("xxxx-xxxx-xxxx-xxxx", "Lance's key");

5. Download .config file

Use method .DownloadConfig() for downloading .config file

Parameters:

  • clientId - Client Id for downloading
  • path - path for saving .config file
client.DownloadConfig("xxxx-xxxx-xxxx-xxxx", "path/to/download");

Also you can download QR-Code with method DownloadQrCode() with parameters clientId and path

Releases

Packages

Used by

Contributors

Languages