Open Carterpersall opened 1 year ago
Why not use Resolve-DnsName
? It will help avoid needless text parsing and it supposedly faster too.
Why not use
Resolve-DnsName
? It will help avoid needless text parsing and it supposedly faster too.
For some reason, I was not aware of the CmdLet's existence. Though in initial testing, I'm seeing a few issues:
nslookup
doesResolve-DnsName
on a cold cache is about 5x slower than nslookup
, while on subsequent runs Resolve-DnsName
uses its cached values which only takes a few millisecondsI'll definitely look a bit further into this though and see what I find (maybe reverse engineering it is possible)
Unfortunately, it seems that Resolve-DnsName
is not in PowerShell Core yet, which means the source code is not available. And without the source code, there isn't much I can do to diagnose its speed issues.
info_local_ip
andinfo_public_ip
with a DNS lookupnslookup -type=a myip.opendns.com
gives both the public IP and local IPinfo_local_ip
:System.Net.Sockets
1.1.1.1
and gets the IP endpoint65530
but any port works in my testinginfo_public_ip
is enabledSystem.Net.Dns
to perform a DNS lookup formyip.opendns.com
myip.opendns.com
and return the sender's IPinfo_public_ip
:http://ifconfig.me/ip
Invoke RestMethod
with[System.Net.WebClient]::new().DownloadString()
Speed: