diagnose: add `getaddrinfos` check (#2960)
diagnose: add `getaddrinfos` check (#2960)

diagnose: add `getaddrinfos` check

Summary:
Networking is hard. Everyone’s machine seems to do something different.
We have a lot of special cases in `program.py`, and we keep finding new
configurations. This commit adds a check to `diagnose_tensorboard.py`
that prints the available loopback and wildcard addresses on all address
families.

It could also be nice to check whether it is actually possible to
connect to sockets opened on the loopback address in various
configurations (e.g., with a direct socket-to-socket connection and with
a Python-provided WSGI server and URL fetcher). We defer such a change.

Test Plan:
On my machine, with Python 3, it prints:

```
socket.has_ipv6 = True
socket.AF_UNSPEC = <AddressFamily.AF_UNSPEC: 0>
socket.SOCK_STREAM = <SocketKind.SOCK_STREAM: 1>
socket.AI_ADDRCONFIG = <AddressInfo.AI_ADDRCONFIG: 32>
socket.AI_PASSIVE = <AddressInfo.AI_PASSIVE: 1>
Loopback flags: <AddressInfo.AI_ADDRCONFIG: 32>
Loopback infos: [(<AddressFamily.AF_INET6: 10>, <SocketKind.SOCK_STREAM: 1>, 6, '', ('::1', 0, 0, 0)), (<AddressFamily.AF_INET: 2>, <SocketKind.SOCK_STREAM: 1>, 6, '', ('127.0.0.1', 0))]
Wildcard flags: <AddressInfo.AI_PASSIVE: 1>
Wildcard infos: [(<AddressFamily.AF_INET: 2>, <SocketKind.SOCK_STREAM: 1>, 6, '', ('0.0.0.0', 0)), (<AddressFamily.AF_INET6: 10>, <SocketKind.SOCK_STREAM: 1>, 6, '', ('::', 0, 0, 0))]
```

With Python 2, it prints the same thing except with only raw numbers for
the socket constants (`<AddressFamily.AI_ADDRCONFIG: 32>` becomes `32`).

wchargin-branch: diagnose-getaddrinfo

tensorflow/tensorboard,tensorflow/tensorboard,tensorflow/tensorboard,tensorflow/tensorboard,tensorflow/tensorboard,tensorflow/tensorboard,tensorflow/tensorboard