Because of issues reaching our normal endpoints hosted outside of China reliably when the user is behind the great firewall, we're looking for a way to reliably determine if the user is currently behind the great firewall and use a different set of endpoint urls hosted within China.
What we would like to do is some kind of check that the client can make, like accessing a url that we know will always be blocked by the firewall forever (or is only accessible from within) or checking some property of the network configuration.
Things currently being considered:
- Checking the device's IP against a list of netblocks assigned to China
- Won't work if the device is behind a NAT firewall
- Doing a traceroute from the device to a host known to be outside of china. If packets are being routed through hosts that are in China (see above) then the device must be in China.
- Might work, but will introduce delays before the app can make calls while it.
- Just ask the user
- Worst case, this may be the best option.