Which operating system?
Linux has getifaddrs, but it doesn't seem to be wrapped in posix, so you have to wrap it yourself.
Windows has GetAdaptersAddresses, which you also have to wrap yourself since it isn't part of winlean.
There may be packages which I don't know of that make this easier.
In Linux and provided you have nimFinLib installed via nimble you can do this :
import cx
showWanIp()
doFinish()