1
0
mirror of https://github.com/zu1k/nali.git synced 2025-02-02 10:22:41 +08:00

chore: Update cdn database url

Signed-off-by: zu1k <i@zu1k.com>
This commit is contained in:
zu1k 2022-04-03 17:25:55 +08:00
parent daa93a0006
commit fe447a34f8
9 changed files with 24 additions and 20 deletions

2
.github/FUNDING.yml vendored
View File

@ -9,4 +9,4 @@ community_bridge: # Replace with a single Community Bridge project-name e.g., cl
liberapay: # Replace with a single Liberapay username liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username otechie: # Replace with a single Otechie username
custom: ['https://lgf.im/donate/']# Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] custom: ['https://zu1k.com/donate/']# Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']

View File

@ -105,7 +105,7 @@ quit
需要你系统中已经安装好 dig 程序 需要你系统中已经安装好 dig 程序
``` ```
$ dig nali.lgf.im +short | nali $ dig nali.zu1k.com +short | nali
104.28.2.115 [美国 CloudFlare公司CDN节点] 104.28.2.115 [美国 CloudFlare公司CDN节点]
104.28.3.115 [美国 CloudFlare公司CDN节点] 104.28.3.115 [美国 CloudFlare公司CDN节点]
172.67.135.48 [美国 CloudFlare节点] 172.67.135.48 [美国 CloudFlare节点]
@ -116,16 +116,16 @@ $ dig nali.lgf.im +short | nali
需要你系统中已经安装好 nslookup 程序 需要你系统中已经安装好 nslookup 程序
``` ```
$ nslookup nali.lgf.im 8.8.8.8 | nali $ nslookup nali.zu1k.com 8.8.8.8 | nali
Server: 8.8.8.8 [美国 加利福尼亚州圣克拉拉县山景市谷歌公司DNS服务器] Server: 8.8.8.8 [美国 加利福尼亚州圣克拉拉县山景市谷歌公司DNS服务器]
Address: 8.8.8.8 [美国 加利福尼亚州圣克拉拉县山景市谷歌公司DNS服务器]#53 Address: 8.8.8.8 [美国 加利福尼亚州圣克拉拉县山景市谷歌公司DNS服务器]#53
Non-authoritative answer: Non-authoritative answer:
Name: nali.lgf.im Name: nali.zu1k.com
Address: 104.28.3.115 [美国 CloudFlare公司CDN节点] Address: 104.28.3.115 [美国 CloudFlare公司CDN节点]
Name: nali.lgf.im Name: nali.zu1k.com
Address: 104.28.2.115 [美国 CloudFlare公司CDN节点] Address: 104.28.2.115 [美国 CloudFlare公司CDN节点]
Name: nali.lgf.im Name: nali.zu1k.com
Address: 172.67.135.48 [美国 CloudFlare节点] Address: 172.67.135.48 [美国 CloudFlare节点]
``` ```
@ -301,7 +301,7 @@ export NALI_DB_HOME=/home/nali
**Nali** © [zu1k](https://github.com/zu1k), 遵循 [MIT](./LICENSE) 证书.<br> **Nali** © [zu1k](https://github.com/zu1k), 遵循 [MIT](./LICENSE) 证书.<br>
> Blog [@zu1k](https://lgf.im) · GitHub [@zu1k](https://github.com/zu1k) · Twitter [@zu1k_lv](https://twitter.com/zu1k_lv) · Telegram Channel [@peekfun](https://t.me/peekfun) > Blog [@zu1k](https://zu1k.com) · GitHub [@zu1k](https://github.com/zu1k) · Twitter [@zu1k_lv](https://twitter.com/zu1k_lv) · Telegram Channel [@peekfun](https://t.me/peekfun)
## Star统计 ## Star统计

View File

@ -102,7 +102,7 @@ quit
### Use with dig ### Use with dig
``` ```
$ dig nali.lgf.im +short | nali $ dig nali.zu1k.com +short | nali
104.28.2.115 [美国 CloudFlare公司CDN节点] 104.28.2.115 [美国 CloudFlare公司CDN节点]
104.28.3.115 [美国 CloudFlare公司CDN节点] 104.28.3.115 [美国 CloudFlare公司CDN节点]
172.67.135.48 [美国 CloudFlare节点] 172.67.135.48 [美国 CloudFlare节点]
@ -111,16 +111,16 @@ $ dig nali.lgf.im +short | nali
### Use with nslookup ### Use with nslookup
``` ```
$ nslookup nali.lgf.im 8.8.8.8 | nali $ nslookup nali.zu1k.com 8.8.8.8 | nali
Server: 8.8.8.8 [美国 加利福尼亚州圣克拉拉县山景市谷歌公司DNS服务器] Server: 8.8.8.8 [美国 加利福尼亚州圣克拉拉县山景市谷歌公司DNS服务器]
Address: 8.8.8.8 [美国 加利福尼亚州圣克拉拉县山景市谷歌公司DNS服务器]#53 Address: 8.8.8.8 [美国 加利福尼亚州圣克拉拉县山景市谷歌公司DNS服务器]#53
Non-authoritative answer: Non-authoritative answer:
Name: nali.lgf.im Name: nali.zu1k.com
Address: 104.28.3.115 [美国 CloudFlare公司CDN节点] Address: 104.28.3.115 [美国 CloudFlare公司CDN节点]
Name: nali.lgf.im Name: nali.zu1k.com
Address: 104.28.2.115 [美国 CloudFlare公司CDN节点] Address: 104.28.2.115 [美国 CloudFlare公司CDN节点]
Name: nali.lgf.im Name: nali.zu1k.com
Address: 172.67.135.48 [美国 CloudFlare节点] Address: 172.67.135.48 [美国 CloudFlare节点]
``` ```
@ -295,7 +295,7 @@ Thanks to JetBrains for the Open Source License
**Nali** © [zu1k](https://github.com/zu1k), Released under the [MIT](./LICENSE) License.<br> **Nali** © [zu1k](https://github.com/zu1k), Released under the [MIT](./LICENSE) License.<br>
> Blog [@zu1k](https://lgf.im) · GitHub [@zu1k](https://github.com/zu1k) · Twitter [@zu1k_lv](https://twitter.com/zu1k_lv) · Telegram Channel [@peekfun](https://t.me/peekfun) > Blog [@zu1k](https://zu1k.com) · GitHub [@zu1k](https://github.com/zu1k) · Twitter [@zu1k_lv](https://twitter.com/zu1k_lv) · Telegram Channel [@peekfun](https://t.me/peekfun)
## Stargazers over time ## Stargazers over time

View File

@ -44,11 +44,11 @@ Find document on: https://github.com/zu1k/nali
#4 Use with dig #4 Use with dig
$ dig nali.lgf.im +short | nali $ dig nali.zu1k.com +short | nali
#5 Use with nslookup #5 Use with nslookup
$ nslookup nali.lgf.im 8.8.8.8 | nali $ nslookup nali.zu1k.com 8.8.8.8 | nali
#6 Use with any other program #6 Use with any other program

1
go.mod
View File

@ -10,6 +10,7 @@ require (
github.com/saracen/go7z v0.0.0-20191010121135-9c09b6bd7fda github.com/saracen/go7z v0.0.0-20191010121135-9c09b6bd7fda
github.com/spf13/cobra v1.4.0 github.com/spf13/cobra v1.4.0
golang.org/x/text v0.3.7 golang.org/x/text v0.3.7
gopkg.in/yaml.v2 v2.4.0
) )
require ( require (

2
go.sum
View File

@ -51,7 +51,9 @@ golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/tools v0.1.7 h1:6j8CgantCy3yc8JGBqkDLMKWqZ0RDU2g1HVgacojGWQ= golang.org/x/tools v0.1.7 h1:6j8CgantCy3yc8JGBqkDLMKWqZ0RDU2g1HVgacojGWQ=
golang.org/x/tools v0.1.7/go.mod h1:LGqMHiF4EqQNHR1JncWGqT5BVaXmza+X+BDGol+dOxo= golang.org/x/tools v0.1.7/go.mod h1:LGqMHiF4EqQNHR1JncWGqT5BVaXmza+X+BDGol+dOxo=
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

View File

@ -22,7 +22,7 @@ var (
GeoLite2CityPath = filepath.Join(constant.HomePath, "GeoLite2-City.mmdb") GeoLite2CityPath = filepath.Join(constant.HomePath, "GeoLite2-City.mmdb")
IPIPFreePath = filepath.Join(constant.HomePath, "ipipfree.ipdb") IPIPFreePath = filepath.Join(constant.HomePath, "ipipfree.ipdb")
Ip2RegionPath = filepath.Join(constant.HomePath, "ip2region.db") Ip2RegionPath = filepath.Join(constant.HomePath, "ip2region.db")
CDNPath = filepath.Join(constant.HomePath, "cdn.json") CDNPath = filepath.Join(constant.HomePath, "cdn.yml")
Language = "zh-CN" Language = "zh-CN"
IPv4DBSelected = "" IPv4DBSelected = ""

View File

@ -1,13 +1,14 @@
package cdn package cdn
import ( import (
"encoding/json"
"errors" "errors"
"fmt" "fmt"
"io/ioutil" "io/ioutil"
"log" "log"
"os" "os"
"strings" "strings"
"gopkg.in/yaml.v2"
) )
type CDN struct { type CDN struct {
@ -49,7 +50,7 @@ func NewCDN(filePath string) (*CDN, error) {
} }
} }
err = json.Unmarshal(cdnData, &cdnDist) err = yaml.Unmarshal(cdnData, &cdnDist)
if err != nil { if err != nil {
return nil, err return nil, err
} }

View File

@ -7,8 +7,8 @@ import (
) )
const ( const (
githubUrl = "https://raw.githubusercontent.com/SukkaLab/cdn/master/dist/cdn.json" githubUrl = "https://raw.githubusercontent.com/SukkaLab/cdn/master/src/cdn.yml"
jsdelivrUrl = "https://cdn.jsdelivr.net/gh/SukkaLab/cdn/dist/cdn.json" jsdelivrUrl = "https://cdn.jsdelivr.net/gh/SukkaLab/cdn/src/cdn.yml"
) )
func Download(filePath ...string) (data []byte, err error) { func Download(filePath ...string) (data []byte, err error) {