![]() |
VOOZH | about |
dotnet add package SharpOpenNat --version 4.0.17
NuGet\Install-Package SharpOpenNat -Version 4.0.17
<PackageReference Include="SharpOpenNat" Version="4.0.17" />
<PackageVersion Include="SharpOpenNat" Version="4.0.17" />Directory.Packages.props
<PackageReference Include="SharpOpenNat" />Project file
paket add SharpOpenNat --version 4.0.17
#r "nuget: SharpOpenNat, 4.0.17"
#:package SharpOpenNat@4.0.17
#addin nuget:?package=SharpOpenNat&version=4.0.17Install as a Cake Addin
#tool nuget:?package=SharpOpenNat&version=4.0.17Install as a Cake Tool
SharpOpenNat is a lightweight and easy-to-use class library to allow port forwarding in NAT devices that support UPNP (Universal Plug & Play) and/or PMP (Port Mapping Protocol).
👁 Build status
👁 NuGet Version
👁 License
NATed computers cannot be reached from outside and this is particularly painful for peer-to-peer or friend-to-friend software. The main goal is to simplify communication amoung computers behind NAT devices that support UPNP and/or PMP providing a clean and easy interface to get the external IP address and map ports and helping you to achieve peer-to-peer communication.
With nuget :
Install-Package SharpOpenNat
Go on the nuget website for more information.
The simplest scenario:
var device = await OpenNat.Discoverer.DiscoverDeviceAsync();
var ip = await device.GetExternalIPAsync();
Console.WriteLine("The external IP Address is: {0} ", ip);
The following piece of code shows a common scenario: It starts the discovery process for a NAT-UPNP device and onces discovered it creates a port mapping. If no device is found before ten seconds, it fails with NatDeviceNotFoundException.
using var cts = new CancellationTokenSource(10000);
var device = await OpenNat.Discoverer.DiscoverDeviceAsync(PortMapper.Upnp, cts.Token);
await device.CreatePortMapAsync(new Mapping(Protocol.Tcp, 1600, 1700, "The mapping name"));
You are welcome to contribute code. You can send code both as a patch or a GitHub pull request.
| Description | Value |
|---|---|
| License | The MIT License (MIT) |
| Documentation | http://jeremyansel.github.io/SharpOpenNat |
| Source code | https://github.com/JeremyAnsel/SharpOpenNat |
| Nuget | https://www.nuget.org/packages/SharpOpenNat |
| Build | https://ci.appveyor.com/project/JeremyAnsel/sharpopennat/branch/main |
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 net5.0 was computed. net5.0-windows net5.0-windows was computed. net6.0 net6.0 is compatible. net6.0-android net6.0-android was computed. net6.0-ios net6.0-ios was computed. net6.0-maccatalyst net6.0-maccatalyst was computed. net6.0-macos net6.0-macos was computed. net6.0-tvos net6.0-tvos was computed. net6.0-windows net6.0-windows was computed. net7.0 net7.0 was computed. net7.0-android net7.0-android was computed. net7.0-ios net7.0-ios was computed. net7.0-maccatalyst net7.0-maccatalyst was computed. net7.0-macos net7.0-macos was computed. net7.0-tvos net7.0-tvos was computed. net7.0-windows net7.0-windows was computed. net8.0 net8.0 is compatible. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 was computed. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 was computed. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 netcoreapp2.0 was computed. netcoreapp2.1 netcoreapp2.1 was computed. netcoreapp2.2 netcoreapp2.2 was computed. netcoreapp3.0 netcoreapp3.0 was computed. netcoreapp3.1 netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 netstandard2.0 is compatible. netstandard2.1 netstandard2.1 was computed. |
| .NET Framework | net461 net461 was computed. net462 net462 was computed. net463 net463 was computed. net47 net47 was computed. net471 net471 was computed. net472 net472 was computed. net48 net48 is compatible. net481 net481 was computed. |
| MonoAndroid | monoandroid monoandroid was computed. |
| MonoMac | monomac monomac was computed. |
| MonoTouch | monotouch monotouch was computed. |
| Tizen | tizen40 tizen40 was computed. tizen60 tizen60 was computed. |
| Xamarin.iOS | xamarinios xamarinios was computed. |
| Xamarin.Mac | xamarinmac xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos xamarinwatchos was computed. |
Showing the top 2 NuGet packages that depend on SharpOpenNat:
| Package | Downloads |
|---|---|
|
sparrow-cert
SparrowCert is a simple certificate renewal library for Kestrel-based services. It can be used in any .NET Core-based web service. The service automatically renews certificates, eliminating the need to worry about certificate expiry. |
|
|
sparrow-upnp
Sparrow.UPnP is a simple UPnP library for .NET Core. It can be used in any .NET Core-based service. The library automatically discovers UPnP devices on the network and provides a simple interface for interacting with them. |
Showing the top 1 popular GitHub repositories that depend on SharpOpenNat:
| Repository | Stars |
|---|---|
|
ciribob/DCS-SimpleRadioStandalone
An open source Stand alone Radio for DCS integrating with all clickable cockpits and FC3 Aircraft
|