mirror of
https://github.com/bin456789/reinstall.git
synced 2025-08-30 13:11:49 +00:00
core: 使用 cloudflare 判断是否国内
This commit is contained in:
@@ -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
|
||||
|
Reference in New Issue
Block a user