Skip to content
This repository has been archived by the owner on Jan 20, 2025. It is now read-only.

Connection fails from IPv4 only network #76

Closed
dbrgn opened this issue Feb 29, 2020 · 3 comments
Closed

Connection fails from IPv4 only network #76

dbrgn opened this issue Feb 29, 2020 · 3 comments

Comments

@dbrgn
Copy link
Contributor

dbrgn commented Feb 29, 2020

The new directory server (#71) has both A (IPv4) and AAAA (IPv6) DNS records. Therefore DNS resolution resolves to an IPv6 address when querying directory.spaceapi.io.

However, from a network that does not support IPv6, that connection will simply fail, no IPv4 fallback is being done.

ipv6

The correct solution for this is RFC6555 (Happy Eyeballs). I'll try to find out if I get that to work on Android.

@dbrgn
Copy link
Contributor Author

dbrgn commented Feb 29, 2020

Hmm, this is strange though... The Android docs say:

This class includes transparent support for IPv6. For hosts with both IPv4 and IPv6 addresses, it will attempt to connect to each of a host's addresses until a connection is established.

I'm not sure why it doesn't work. It also only seems to happen on older devices (fails on Android 5, but works on Android 9). Maybe that wasn't yet implemented in older versions.

@dbrgn
Copy link
Contributor Author

dbrgn commented Feb 29, 2020

My assumption would be that IPv6 dual stack support was added sometime between Android 5 and 9. Since the default HTTP client won't be updated on older devices, we'll have to either:

  • Implement Happy Eyeballs ourselves, or
  • force IPv4-only, or
  • use a different HTTP client

The first approach is possible, but requires some work. I would very much object to the second one.

Using a HTTP client like https://square.github.io/okhttp/ would resolve these issues. It's also much mroe future-proof and supports things like HTTP/2. Main downside is that it would be the first external dependency, it requires Android 5 (see #75) and it requires the Kotlin standard library.

If you can live with the fact that the app won't be ~100 KiB anymore, that is the best approach in my view. And since OkHttp already requires the Kotlin stdlib, we could also think about using Kotlin ourselves. Release APK size would increase from ~70 KiB to ~1 MiB.

Thoughts, @rorist?

@dbrgn
Copy link
Contributor Author

dbrgn commented Feb 29, 2020

Never mind, this is most probably an issue with the TLS cipher configuration on the directory.spaceapi.io server.

https://www.ssllabs.com/ssltest/analyze.html?d=directory.spaceapi.io&s=116.203.2.80

@dbrgn dbrgn closed this as completed Feb 29, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant