mirror of
https://github.com/zu1k/nali.git
synced 2025-01-23 05:39:03 +08:00
add download fail catch
This commit is contained in:
parent
f2b8a958b9
commit
2e4000af79
@ -28,10 +28,11 @@ func NewCDN(filePath string) CDN {
|
||||
log.Println("文件不存在,尝试从网络获取最新CDN数据库")
|
||||
cdnData, err = Download()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
log.Printf("CDN数据库下载失败,请手动下载解压后保存到本地: %s \n", filePath)
|
||||
log.Println("下载链接: https://cdn.jsdelivr.net/gh/SukkaLab/cdn/dist/cdn.json")
|
||||
} else {
|
||||
if err := ioutil.WriteFile(filePath, cdnData, 0644); err == nil {
|
||||
log.Printf("已将最新的 CDN数据库 保存到本地: %s ", filePath)
|
||||
log.Printf("已将最新的 CDN数据库 保存到本地: %s \n", filePath)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -28,7 +28,8 @@ func NewQQwry(filePath string) QQwry {
|
||||
log.Println("文件不存在,尝试从网络获取最新纯真 IP 库")
|
||||
fileData, err = Download()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
log.Printf("纯真IP库下载失败,请手动下载解压后保存到本地: %s \n", filePath)
|
||||
log.Println("下载链接: https://qqwry.mirror.noc.one/qqwry.rar")
|
||||
} else {
|
||||
if err := ioutil.WriteFile(filePath, fileData, 0644); err == nil {
|
||||
log.Printf("已将最新的 纯真IP库 保存到本地: %s ", filePath)
|
||||
|
@ -24,7 +24,8 @@ func NewZXwry(filePath string) ZXwry {
|
||||
// 判断文件是否存在
|
||||
_, err := os.Stat(filePath)
|
||||
if err != nil && os.IsNotExist(err) {
|
||||
log.Println("文件不存在,请自行下载 ZX IPV6库,并保存在", filePath)
|
||||
log.Println("文件不存在,请自行下载 ZX IPV6库,解压并保存在", filePath)
|
||||
log.Println("下载链接: https://www.zxinc.org/ip.7z")
|
||||
os.Exit(1)
|
||||
} else {
|
||||
// 打开文件句柄
|
||||
|
Loading…
Reference in New Issue
Block a user