Whose Endpoint Is It Anyway, the library where every result is helpful and the expectations against code without pop culture references do not matter mhm.. cough... what I meant to say was:
A tiny .net standard library to help you find your friendly neighborhood endpoint in the sea of vEthernets and npcap loopback points.
For most usecases you only need 2 lines.
using WhoseEndpointIsItAnyway;
// ...
var ep = NetworkHelper.GetFriendlyNeighborhoodEndpoint();
Console.WriteLine($"What you're looking for is: {ep.Unicast} {ep.Broadcast} {ep.IsWan}");
You can also pass a true
to the method above to return the WAN address if the device has one.
You can also ask for a ranked (and sorted) list of all the operational endpoints.
var ranked = NetworkHelper.RankEndpoints();
Every returned endpoint has a Rank
property that can range from 0 to 6 as follows:
- WAN
- probably what you want (usually home, small office)
- probably what you want (usually enterprise)
- might be what you want, but probably infrastructure for virtual machines or something similar
- most definitely infrastructure for virtual machines or something similar
- link local addresses
- something wrong, don't use it