WireGuardNT-PInvoke 1.0.5

dotnet add package WireGuardNT-PInvoke --version 1.0.5
NuGet\Install-Package WireGuardNT-PInvoke -Version 1.0.5
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="WireGuardNT-PInvoke" Version="1.0.5" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add WireGuardNT-PInvoke --version 1.0.5
#r "nuget: WireGuardNT-PInvoke, 1.0.5"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install WireGuardNT-PInvoke as a Cake Addin
#addin nuget:?package=WireGuardNT-PInvoke&version=1.0.5

// Install WireGuardNT-PInvoke as a Cake Tool
#tool nuget:?package=WireGuardNT-PInvoke&version=1.0.5

WireGuardNT PInvoke with Csharp, sharp, Windows

.NET binding over WireGuardNT

WireGuardNT-PInvoke library written in C# targeting .NET Standard 2.0. Version.

WireGuard-Cli

Save the configuration file to the path of the Example program, and then use the following code to load the configuration file.

Also, I created project with reference to the following link.

WireGuardNT/Example.C WireGuardNT/embeddable-dll-service

client.conf

[Interface]
Address = 10.0.0.2/24
ListenPort = 51820
PrivateKey = ==SOME===PRIVATE===key==

[Peer]
PublicKey = ==SOME===PUBLIC===KEY==
AllowedIPs = 0.0.0.0/0, ::/0
Endpoint = myserver.dyndns.org:51820

Example->Program.cs

...
NET_LUID adapterLuid;
WgConfig WgConfig = new WgConfig();

var baseName = System.IO.Path.GetDirectoryName(Process.GetCurrentProcess().MainModule.FileName); 
var configFile = System.IO.Path.Combine(baseName, "client.conf");
//Read all line from config file
var configAllLinesLine = File.ReadAllLines(configFile);
            
var adapterName = "wgtest";
var tunnelType = "wgtest";

//Create Some GUID
var adapterGuid = Guid.Parse("{0xdeadc001,0xbeef,0xbabe,{0x01,0x23,0x45,0x67,0x89,0xab,0xcd,0xef}}");
//Get Adapter
var adapter = new Adapter(adapterName, tunnelType);
adapter.ParseConfFile(configAllLinesLine, out WgConfig);
...
adapter.SetConfiguration(WgConfig);
adapter.SetStateUp();

And Run the program.

Visual Studio -> Choose WireGuard-Cli -> Run
Run Cmd -> netsh interface show interface or ipconfig

GIF

alternate text is missing from this package README image

Using Cli

Release

Usage: WireGuard-Cli.exe [OPTION...]
 -v          version
 -c          config "config file path" default path is "client.conf"
 -n          name "adapter name" default name is "client"
 -t          type "tunnel type" default type is "client"

Nuget Package

WireGuardNT-PInvoke

Install-Package WireGuardNT-PInvoke 

TODO

[ ] IPv6 Support
[ ] Code Refactor
[ ] Nuget Package
[ ] Add more example
[ ] TestCode
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.5 279 8/25/2023
1.0.4 458 3/5/2023
1.0.0 287 9/1/2022