1
0
mirror of https://github.com/fumiama/RVC-Models-Downloader.git synced 2024-09-29 14:26:25 +09:00

feat(dns): optimize parsing

This commit is contained in:
源文雨 2024-04-21 01:26:30 +09:00
parent d9cf7b6b3e
commit 38a12caea6
4 changed files with 35 additions and 10 deletions

28
dns.yaml Normal file
View File

@ -0,0 +1,28 @@
Servers: {}
Fallbacks:
cdn-lfs.huggingface.co:
- 3.163.218.77
- 3.163.218.75
- 3.163.218.60
- 3.163.218.88
- 2600:9000:26a9:6e00:11:f807:5180:93a1
- 2600:9000:26a9:8400:11:f807:5180:93a1
- 2600:9000:26a9:e400:11:f807:5180:93a1
- 2600:9000:26a9:6400:11:f807:5180:93a1
- 2600:9000:26a9:f400:11:f807:5180:93a1
- 2600:9000:26a9:ec00:11:f807:5180:93a1
- 2600:9000:26a9:6600:11:f807:5180:93a1
- 2600:9000:26a9:fa00:11:f807:5180:93a1
huggingface.co:
- 18.65.159.75
- 18.65.159.63
- 18.65.159.2
- 18.65.159.20
- 2600:9000:2218:9200:17:b174:6d00:93a1
- 2600:9000:2218:e00:17:b174:6d00:93a1
- 2600:9000:2218:4800:17:b174:6d00:93a1
- 2600:9000:2218:6c00:17:b174:6d00:93a1
- 2600:9000:2218:b200:17:b174:6d00:93a1
- 2600:9000:2218:6800:17:b174:6d00:93a1
- 2600:9000:2218:c800:17:b174:6d00:93a1
- 2600:9000:2218:2e00:17:b174:6d00:93a1

7
go.mod
View File

@ -3,17 +3,14 @@ module rvcmd
go 1.22.1 go 1.22.1
require ( require (
github.com/fumiama/terasu v0.0.0-20240420161109-c8c0088d72cd
github.com/gizak/termui/v3 v3.1.0
github.com/pkg/errors v0.9.1 github.com/pkg/errors v0.9.1
github.com/sirupsen/logrus v1.9.3 github.com/sirupsen/logrus v1.9.3
golang.org/x/sys v0.19.0 golang.org/x/sys v0.19.0
gopkg.in/yaml.v3 v3.0.1 gopkg.in/yaml.v3 v3.0.1
) )
require (
github.com/fumiama/terasu v0.0.0-20240418161858-1c3273a78268
github.com/gizak/termui/v3 v3.1.0
)
require ( require (
github.com/FloatTech/ttl v0.0.0-20230307105452-d6f7b2b647d1 // indirect github.com/FloatTech/ttl v0.0.0-20230307105452-d6f7b2b647d1 // indirect
github.com/RomiChan/syncx v0.0.0-20240418144900-b7402ffdebc7 // indirect github.com/RomiChan/syncx v0.0.0-20240418144900-b7402ffdebc7 // indirect

4
go.sum
View File

@ -5,8 +5,8 @@ github.com/RomiChan/syncx v0.0.0-20240418144900-b7402ffdebc7/go.mod h1:vD7Ra3Q9o
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/fumiama/terasu v0.0.0-20240418161858-1c3273a78268 h1:6R8kSGVSIoR3xm2NG8Z4ivkTpAET783RFsJOVKrI7n8= github.com/fumiama/terasu v0.0.0-20240420161109-c8c0088d72cd h1:cEUaAUdb1uVyOfEenCMtU3lUMELTVwepn/g7UL/CK54=
github.com/fumiama/terasu v0.0.0-20240418161858-1c3273a78268/go.mod h1:afchyfKAb7J/zvaENtYzjIEPVbwiEjJaow05zzT4usM= github.com/fumiama/terasu v0.0.0-20240420161109-c8c0088d72cd/go.mod h1:afchyfKAb7J/zvaENtYzjIEPVbwiEjJaow05zzT4usM=
github.com/gizak/termui/v3 v3.1.0 h1:ZZmVDgwHl7gR7elfKf1xc4IudXZ5qqfDh4wExk4Iajc= github.com/gizak/termui/v3 v3.1.0 h1:ZZmVDgwHl7gR7elfKf1xc4IudXZ5qqfDh4wExk4Iajc=
github.com/gizak/termui/v3 v3.1.0/go.mod h1:bXQEBkJpzxUAKf0+xq9MSWAvWZlE7c+aidmyFlkYTrY= github.com/gizak/termui/v3 v3.1.0/go.mod h1:bXQEBkJpzxUAKf0+xq9MSWAvWZlE7c+aidmyFlkYTrY=
github.com/mattn/go-runewidth v0.0.2 h1:UnlwIPBGaTZfPQ6T1IGzPI0EkYAQmT9fAEJ/poFC63o= github.com/mattn/go-runewidth v0.0.2 h1:UnlwIPBGaTZfPQ6T1IGzPI0EkYAQmT9fAEJ/poFC63o=

View File

@ -68,7 +68,7 @@ func main() {
errorln("open custom dns file", *dnsf, "err:", err) errorln("open custom dns file", *dnsf, "err:", err)
return return
} }
m := map[string][]string{} m := dns.DNSConfig{}
err = yaml.NewDecoder(f).Decode(&m) err = yaml.NewDecoder(f).Decode(&m)
if err != nil { if err != nil {
errorln("decode custom dns file", *dnsf, "err:", err) errorln("decode custom dns file", *dnsf, "err:", err)
@ -76,9 +76,9 @@ func main() {
} }
_ = f.Close() _ = f.Close()
if ip.IsIPv6Available.Get() { if ip.IsIPv6Available.Get() {
dns.IPv6Servers.Add(m) dns.IPv6Servers.Add(&m)
} else { } else {
dns.IPv4Servers.Add(m) dns.IPv4Servers.Add(&m)
} }
infoln("custom dns file added") infoln("custom dns file added")
} }