Skip to content

Commit

Permalink
feat(dns): optimize parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
fumiama committed Apr 20, 2024
1 parent d9cf7b6 commit 38a12ca
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 10 deletions.
28 changes: 28 additions & 0 deletions dns.yaml
Original file line number Diff line number Diff line change
@@ -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 changes: 2 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,14 @@ module rvcmd
go 1.22.1

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/sirupsen/logrus v1.9.3
golang.org/x/sys v0.19.0
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 (
github.com/FloatTech/ttl v0.0.0-20230307105452-d6f7b2b647d1 // indirect
github.com/RomiChan/syncx v0.0.0-20240418144900-b7402ffdebc7 // indirect
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
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-20240418161858-1c3273a78268/go.mod h1:afchyfKAb7J/zvaENtYzjIEPVbwiEjJaow05zzT4usM=
github.com/fumiama/terasu v0.0.0-20240420161109-c8c0088d72cd h1:cEUaAUdb1uVyOfEenCMtU3lUMELTVwepn/g7UL/CK54=
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/go.mod h1:bXQEBkJpzxUAKf0+xq9MSWAvWZlE7c+aidmyFlkYTrY=
github.com/mattn/go-runewidth v0.0.2 h1:UnlwIPBGaTZfPQ6T1IGzPI0EkYAQmT9fAEJ/poFC63o=
Expand Down
6 changes: 3 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,17 +68,17 @@ func main() {
errorln("open custom dns file", *dnsf, "err:", err)
return
}
m := map[string][]string{}
m := dns.DNSConfig{}
err = yaml.NewDecoder(f).Decode(&m)
if err != nil {
errorln("decode custom dns file", *dnsf, "err:", err)
return
}
_ = f.Close()
if ip.IsIPv6Available.Get() {
dns.IPv6Servers.Add(m)
dns.IPv6Servers.Add(&m)
} else {
dns.IPv4Servers.Add(m)
dns.IPv4Servers.Add(&m)
}
infoln("custom dns file added")
}
Expand Down

0 comments on commit 38a12ca

Please sign in to comment.