diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index 310b5aa..fcb7632 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -9,4 +9,4 @@ community_bridge: # Replace with a single Community Bridge project-name e.g., cl liberapay: # Replace with a single Liberapay username issuehunt: # Replace with a single IssueHunt 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'] diff --git a/README.md b/README.md index e9445ce..3edfd89 100644 --- a/README.md +++ b/README.md @@ -105,7 +105,7 @@ quit 需要你系统中已经安装好 dig 程序 ``` -$ dig nali.lgf.im +short | nali +$ dig nali.zu1k.com +short | nali 104.28.2.115 [美国 CloudFlare公司CDN节点] 104.28.3.115 [美国 CloudFlare公司CDN节点] 172.67.135.48 [美国 CloudFlare节点] @@ -116,16 +116,16 @@ $ dig nali.lgf.im +short | nali 需要你系统中已经安装好 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服务器] Address: 8.8.8.8 [美国 加利福尼亚州圣克拉拉县山景市谷歌公司DNS服务器]#53 Non-authoritative answer: -Name: nali.lgf.im +Name: nali.zu1k.com Address: 104.28.3.115 [美国 CloudFlare公司CDN节点] -Name: nali.lgf.im +Name: nali.zu1k.com Address: 104.28.2.115 [美国 CloudFlare公司CDN节点] -Name: nali.lgf.im +Name: nali.zu1k.com Address: 172.67.135.48 [美国 CloudFlare节点] ``` @@ -301,7 +301,7 @@ export NALI_DB_HOME=/home/nali **Nali** © [zu1k](https://github.com/zu1k), 遵循 [MIT](./LICENSE) 证书.
-> 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统计 diff --git a/README_en.md b/README_en.md index b945bac..1c9cbd3 100644 --- a/README_en.md +++ b/README_en.md @@ -102,7 +102,7 @@ quit ### Use with dig ``` -$ dig nali.lgf.im +short | nali +$ dig nali.zu1k.com +short | nali 104.28.2.115 [美国 CloudFlare公司CDN节点] 104.28.3.115 [美国 CloudFlare公司CDN节点] 172.67.135.48 [美国 CloudFlare节点] @@ -111,16 +111,16 @@ $ dig nali.lgf.im +short | nali ### 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服务器] Address: 8.8.8.8 [美国 加利福尼亚州圣克拉拉县山景市谷歌公司DNS服务器]#53 Non-authoritative answer: -Name: nali.lgf.im +Name: nali.zu1k.com Address: 104.28.3.115 [美国 CloudFlare公司CDN节点] -Name: nali.lgf.im +Name: nali.zu1k.com Address: 104.28.2.115 [美国 CloudFlare公司CDN节点] -Name: nali.lgf.im +Name: nali.zu1k.com 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.
-> 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 diff --git a/cmd/root.go b/cmd/root.go index 2e62d73..12b8db8 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -44,11 +44,11 @@ Find document on: https://github.com/zu1k/nali #4 Use with dig - $ dig nali.lgf.im +short | nali + $ dig nali.zu1k.com +short | nali #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 diff --git a/go.mod b/go.mod index 6190c87..cb7dc9b 100644 --- a/go.mod +++ b/go.mod @@ -10,6 +10,7 @@ require ( github.com/saracen/go7z v0.0.0-20191010121135-9c09b6bd7fda github.com/spf13/cobra v1.4.0 golang.org/x/text v0.3.7 + gopkg.in/yaml.v2 v2.4.0 ) require ( diff --git a/go.sum b/go.sum index cbcf3e3..9a93dcc 100644 --- a/go.sum +++ b/go.sum @@ -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/go.mod h1:LGqMHiF4EqQNHR1JncWGqT5BVaXmza+X+BDGol+dOxo= 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/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= 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/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/internal/db/db.go b/internal/db/db.go index 97dcccf..617e5ce 100644 --- a/internal/db/db.go +++ b/internal/db/db.go @@ -22,7 +22,7 @@ var ( GeoLite2CityPath = filepath.Join(constant.HomePath, "GeoLite2-City.mmdb") IPIPFreePath = filepath.Join(constant.HomePath, "ipipfree.ipdb") Ip2RegionPath = filepath.Join(constant.HomePath, "ip2region.db") - CDNPath = filepath.Join(constant.HomePath, "cdn.json") + CDNPath = filepath.Join(constant.HomePath, "cdn.yml") Language = "zh-CN" IPv4DBSelected = "" diff --git a/pkg/cdn/cdn.go b/pkg/cdn/cdn.go index 99b1e3a..50d8666 100644 --- a/pkg/cdn/cdn.go +++ b/pkg/cdn/cdn.go @@ -1,13 +1,14 @@ package cdn import ( - "encoding/json" "errors" "fmt" "io/ioutil" "log" "os" "strings" + + "gopkg.in/yaml.v2" ) 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 { return nil, err } diff --git a/pkg/cdn/update.go b/pkg/cdn/update.go index 2aa7e23..ffac859 100644 --- a/pkg/cdn/update.go +++ b/pkg/cdn/update.go @@ -7,8 +7,8 @@ import ( ) const ( - githubUrl = "https://raw.githubusercontent.com/SukkaLab/cdn/master/dist/cdn.json" - jsdelivrUrl = "https://cdn.jsdelivr.net/gh/SukkaLab/cdn/dist/cdn.json" + githubUrl = "https://raw.githubusercontent.com/SukkaLab/cdn/master/src/cdn.yml" + jsdelivrUrl = "https://cdn.jsdelivr.net/gh/SukkaLab/cdn/src/cdn.yml" ) func Download(filePath ...string) (data []byte, err error) {