cloudflare / roughtime

A secure clock-synchronization protocol for when rough is enough.
https://developers.cloudflare.com/time-services/roughtime/
Apache License 2.0
136 stars 30 forks source link

Support IPv6 only connectivity #10

Closed bluecmd closed 5 years ago

bluecmd commented 6 years ago

Hi,

I have a host that may only have IPv6 external connectivity, or only IPv4, or both.

The serverUDPAddr function will always resolve to IPv4 addresses, even if there is no default route or any sign of external connectivity. Ideally, having a server that is capable of both IPv4 and IPv6 one should be tried and then if that doesn't work it should try with the other. Right now, only IPv4 will be tried.

Example where the DNS resolution works since the system uses IPv6 DNS resolvers, but roughtime is not able to connect:

1970/01/01 00:11:02 Failed to get roughtime from roughtime.sandbox.google.com:2002 (skipping): dial udp 64.233.164.158:2002: connect: network is unreachable
cjpatton commented 5 years ago

Fixed by #9.