Hto3.NetworkHelpers
1.0.7
dotnet add package Hto3.NetworkHelpers --version 1.0.7
NuGet\Install-Package Hto3.NetworkHelpers -Version 1.0.7
<PackageReference Include="Hto3.NetworkHelpers" Version="1.0.7" />
paket add Hto3.NetworkHelpers --version 1.0.7
#r "nuget: Hto3.NetworkHelpers, 1.0.7"
// Install Hto3.NetworkHelpers as a Cake Addin #addin nuget:?package=Hto3.NetworkHelpers&version=1.0.7 // Install Hto3.NetworkHelpers as a Cake Tool #tool nuget:?package=Hto3.NetworkHelpers&version=1.0.7
Hto3.NetworkHelpers
Features
Network helper methods.
GetLocalIPv4Addresses
Get all lan IPv4 addreesses of this machine.
IEnumerable<IPAddress> ipAddresses = NetworkHelpers.GetLocalIPv4Addresses();
GetHostNameThroughIPAddressAsync
Get host name through IP address.
String hostname = await NetworkHelpers.GetHostNameThroughIPAddressAsync("66.171.248.178");
GetExternalIPAddressAsync
Get external IP address of this machine.
IPAddress ipAddress = await NetworkHelpers.GetExternalIPAddressAsync();
GetExternalDNSRecordAsync
Returns the reverse DNS record (PTR) for your external IP.
String dnsRecord await NetworkHelpers.GetExternalDNSRecordAsync();
//something like a1799.dscb.akamai.net
GetLocalIPv4AddressToReachInternet
Get the local ip address to reach the Internet.
IPAddress ipAddress = NetworkHelpers.GetLocalIPv4AddressToReachInternet()
ValidateCIDRIP
Validate a CIDR Ip string (i.e "10.0.0.0/24")
const String WRONG_CIDR_IP = "192.168.1.1/";
Boolean result = NetworkHelpers.ValidateCIDRIP(WRONG_CIDR_IP);
//result is false
const String VALID_CIDR_IP = "10.0.0.0/24";
Boolean result = NetworkHelpers.ValidateCIDRIP(VALID_CIDR_IP);
//result is true
GetIpv4SubnetFromNetMask
This Function is Used to get Subnet based on NetMask (i.e 0-32).
IPAddress result = NetworkHelpers.GetIpv4SubnetFromNetMask(23);
//Result is "255.255.254.0"
IsIpv4AddressInRange
Check if the provided Ip is in range of the CIDR Ip.
IPAddress IP = IPAddress.Parse("192.168.1.1");
String CIDR_IP_16 = "192.168.0.0/16";
Boolean result = NetworkHelpers.IsIpv4AddressInRange(IP, CIDR_IP_16);
//result is true
IPAddress IP = IPAddress.Parse("10.0.0.1");
String CIDR_IP_24 = "192.168.0.0/24";
Boolean result = NetworkHelpers.IsIpv4AddressInRange(IP, CIDR_IP_24);
//result is false
IsIpv4AddressInPrivateAddressSpace
Check if the provided Ip is in the private address space.
IPAddress PRIVATE_IP_ADDRESS = IPAddress.Parse("192.168.1.1");
Boolean result = NetworkHelpers.IsIpv4AddressInPrivateAddressSpace(PRIVATE_IP_ADDRESS);
//result is true
IPAddress PUBLIC_IP_ADDRESS = IPAddress.Parse("200.87.14.111");
Boolean result = NetworkHelpers.IsIpv4AddressInPrivateAddressSpace(PUBLIC_IP_ADDRESS);
//result is false
IsIpv4AddressInPublicAddressSpace
Check if the provided Ip is in the public address space.
IPAddress PRIVATE_IP_ADDRESS = IPAddress.Parse("192.168.1.1");
Boolean result = NetworkHelpers.IsIpv4AddressInPublicAddressSpace(PRIVATE_IP_ADDRESS);
//result is false
IPAddress PUBLIC_IP_ADDRESS = IPAddress.Parse("200.87.14.111");
Boolean result = NetworkHelpers.IsIpv4AddressInPublicAddressSpace(PUBLIC_IP_ADDRESS);
//result is true
GetNetworkInterfaceVendorNameByMACAddress
Get the network interface vendor name by MAC address. Null if not found.
String result = NetworkHelpers.GetNetworkInterfaceVendorNameByMACAddress("40-8D-5C-4D-EC-A6");
//result is "GIGA-BYTE TECHNOLOGY CO.,LTD."
GetKnownPort
Get information about a known port. Null if not found.
var result = NetworkHelpers.GetKnownPort(1433, ProtocolType.Tcp);
//result is
// * ServiceName: "ms-sql-s."
// * Port: 1433
// * Protocol: ProtocolType.Tcp
// * Description: "Microsoft-SQL-Server"
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 is compatible. net5.0-windows was computed. net6.0 is compatible. 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 is compatible. 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 is compatible. 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 is compatible. |
.NET Framework | net461 is compatible. net462 was computed. net463 was computed. net47 is compatible. net471 was computed. net472 was computed. net48 is compatible. 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. |
-
.NETFramework 4.6.1
- No dependencies.
-
.NETFramework 4.7
- No dependencies.
-
.NETFramework 4.8
- No dependencies.
-
.NETStandard 2.0
- No dependencies.
-
.NETStandard 2.1
- No dependencies.
-
net5.0
- No dependencies.
-
net6.0
- No dependencies.
-
net7.0
- No dependencies.
-
net8.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.