getNeighbors returning IPs in different formats
When making the getNeighbors call, it returned me a IP in this format: "address": "92.ip-51-XXX-195.eu:14265", After restarting the IRI, I made the getNeighbors call again, just that it this time returned: "address": "51.XXX.195.92:14265",
This first result seems to me like a bug. Strange thing, after a while (10min maybe) the getNeighbors call again returned the IPs in a strange format, just that when restarting this time, nothing changed. Maybe this has something to do with the DNS updater, which was implemented some versions ago?
I think you mean the DNS Resolver. Its not a bug, its a feature.
Is this related to the "Checking neighbor ip..." message I see occasionally in the IRI output?
@pinpong Yes you are probably right.
Though personally I would like it if getNeighbors would return the plain IP/DNS as it was entered in the neighbor configuration. If looking for a neighbor, and its displayed in such a abstract way that the numbers of the IP aren't even displayed in the correct order, then its just very hard to spot the neighbor I am looking for.
@todofixthis Yes quite sure it is.
Including this info 'cause I know you're a Python dev (:
Note: in Python, you can use socket.gethostbyname to resolve a hostname into an IP address. Even if the IRI doesn't provide IP addresses, it shouldn't be too difficult to resolve them in the calling script:
In [1]: import socket
In [2]: socket.gethostbyname('example.com')
Out[2]: '93.184.216.34'
See https://docs.python.org/2/library/socket.html#socket.gethostbyname for more information.
Thanks! This looks like a good solution. And sorry for the late reply, some how forgot.