Skip to content

Conversation

@mysterywolf
Copy link
Member

@mysterywolf mysterywolf commented Sep 13, 2022

Env自动通过IP归属地来确定是否使用gitee镜像源,无需再手动配置:
此种方式优点多多:

  1. 国内国外在使用github/gitee上自动确认,不会出现国内莫名其妙走github或者海外莫名其妙走gitee的幺蛾子
  2. 在国内使用VPN时,如果采用手动配置的方式,那将依旧走gitee,可能会存在下载失败的问题。而通过IP自动确认的方式,在国内使用VPN时,就会直接走github的镜像源了。

@mysterywolf
Copy link
Member Author

import requests

try:
    ip = requests.get('http://ip.42.pl/raw').content.decode()
    print('本机所在公网IP是:', ip)

    url = 'http://www.ip-api.com/json/' + ip
    response = requests.get(url)
    print(response.json()['country'])
except:
    print('Fail to get the ip location!')

@Guozhanxin
Copy link
Member

自动挡虽好,是不是还是要留个手动挡比较安全

@mysterywolf
Copy link
Member Author

手动这块在linux以及苹果Mac os下无效,这个只对windows有效果。

@mysterywolf
Copy link
Member Author

整个menuconfig -s在macos和linux下都没有效果。

@mysterywolf mysterywolf merged commit bbf7238 into master Sep 14, 2022
@mysterywolf mysterywolf deleted the autoiplocation branch September 14, 2022 02:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants