core: 使用 cloudflare 判断是否国内

This commit is contained in:
bin456789 2023-07-15 23:59:33 +08:00
parent 2bd176fd26
commit 5fae23798e
No known key found for this signature in database
GPG Key ID: EE301B386DE6C11B

View File

@ -34,9 +34,9 @@ curl() {
is_in_china() {
if [ -z $_is_in_china ]; then
# https://geoip.fedoraproject.org/city
# https://geoip.ubuntu.com/lookup
curl -L https://geoip.ubuntu.com/lookup | grep -qw CHN
# https://geoip.fedoraproject.org/city # 不支持 ipv6
# https://geoip.ubuntu.com/lookup # 不支持 ipv6
curl -L http://www.cloudflare.com/cdn-cgi/trace | grep -qx 'loc=CN'
_is_in_china=$?
fi
return $_is_in_china